A, B = map(int, input().split()) while B: C = A & B A ^= B B = C << 1 print(A)