a = int(input())
b = int(input())
res = 0
while a != 0:
    c = a ^ b
    d = (a & b) << 1
    a = d
    b = c
    res = res + 1
print(b)