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

while b!=0:
    a = (a&b)<<1
    b = a^b

print(a)