while 1:print`[int(n)+3>>k&1for n in`input()`for k in 3,2,1,0]`[1::3]