s=[0] for i in range(1,23): s.append(s[-1]+i) i=0 while i<50 print(int(int(input(),2) in s)) i+=1