for i in range (32): s=input() s=s+s if '01' in s : print(1) else : print(0)