while 1 {puts [expr -0x[gets stdin]%15]}