x,y=[int(i) for i in input().split()]
print(x and y)
print(x or y)
print(not x)
print(not y)