import sys
# 没有添加 map() 错误
x , y = map(int,input().split())

print(x and y)
print(x or y)
print(not x)
print(not y)