a = int(input())
b = int(input())

while b:
    c = a ^ b
    d = 2 * (a & b)
    a = c
    b = d

print(a)