ans = [1, 0]

print((ans[int(eval(input()))]))
print((0 if bool(int(eval(input()))) else 1))
ans = [1, 0]
print((ans[int(eval(input()))]))

print((0 if bool(int(eval(input()))) else 1))

-ans = [1, 0] -print((ans[int(eval(input()))])) +print((0 if bool(int(eval(input()))) else 1))