A, B = map(int, input().split())
bin_A = bin(A - 1)
bin_B = bin(B)
A_xor = [0 for _ in range(len(bin_B) - 2)]
B_xor = [0 for _ in range(len(bin_B) - 2)]
for i in range(len(bin_B)):
    if i == 0:
        if B % 4 == 1 or B % 4 == 2:
            B_xor[i] = 1
    else:  
        if (B // pow(2, i)) % 2 == 1 and (B % pow(2, i)) % 2 == 0:
            B_xor[i] = 1
if A == 0:
    print(int("".join(map(str, B_xor[::-1])), 2))
    exit()
for i in range(len(bin_A)):
    if i == 0:
        if (A - 1) % 4 == 1 or (A - 1) % 4 == 2:
            A_xor[i] = 1
    else:
        if ((A - 1) // pow(2, i)) % 2 == 1 and ((A - 1) % pow(2, i)) % 2 == 0:
            A_xor[i] = 1
ans = []
for a, b in zip(A_xor, B_xor):
    if a != b:
        ans.append(1)
    else:
        ans.append(0)
print(int("".join(map(str, ans[::-1])), 2)) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B bin_A = bin(A - 1) bin_A bin(A - 1) bin A - 1 A 1 bin_B = bin(B) bin_B bin(B) bin B 0 for _ in range(len(bin_B) - 2) for _ in range(len(bin_B) - 2) _ range(len(bin_B) - 2) range len(bin_B) - 2 len(bin_B) len bin_B 2 for _ in range(len(bin_B) - 2) 0 A_xor = [0 for _ in range(len(bin_B) - 2)] A_xor [0 for _ in range(len(bin_B) - 2)] 0 for _ in range(len(bin_B) - 2) for _ in range(len(bin_B) - 2) _ range(len(bin_B) - 2) range len(bin_B) - 2 len(bin_B) len bin_B 2 for _ in range(len(bin_B) - 2) 0 B_xor = [0 for _ in range(len(bin_B) - 2)] B_xor [0 for _ in range(len(bin_B) - 2)] for i in range(len(bin_B)):
    if i == 0:
        if B % 4 == 1 or B % 4 == 2:
            B_xor[i] = 1
    else:  
        if (B // pow(2, i)) % 2 == 1 and (B % pow(2, i)) % 2 == 0:
            B_xor[i] = 1 i range(len(bin_B)) range len(bin_B) len bin_B if i == 0:
        if B % 4 == 1 or B % 4 == 2:
            B_xor[i] = 1
    else:  
        if (B // pow(2, i)) % 2 == 1 and (B % pow(2, i)) % 2 == 0:
            B_xor[i] = 1 i == 0 i 0 if B % 4 == 1 or B % 4 == 2:
            B_xor[i] = 1
     B % 4 == 1 or B % 4 == 2 B % 4 == 1 B % 4 B 4 1 B % 4 == 2 B % 4 B 4 2 B_xor[i] = 1 B_xor[i] B_xor i 1 if (B // pow(2, i)) % 2 == 1 and (B % pow(2, i)) % 2 == 0:
            B_xor[i] = 1 (B // pow(2, i)) % 2 == 1 and (B % pow(2, i)) % 2 == 0 (B // pow(2, i)) % 2 == 1 (B // pow(2, i)) % 2 B // pow(2, i) B pow(2, i) pow 2 i 2 1 (B % pow(2, i)) % 2 == 0 (B % pow(2, i)) % 2 B % pow(2, i) B pow(2, i) pow 2 i 2 0 B_xor[i] = 1 B_xor[i] B_xor i 1 if A == 0:
    print(int("".join(map(str, B_xor[::-1])), 2))
    exit() A == 0 A 0 print(int("".join(map(str, B_xor[::-1])), 2)) print int("".join(map(str, B_xor[::-1])), 2) int "".join(map(str, B_xor[::-1])) "".join "" join map(str, B_xor[::-1]) map str B_xor[::-1] B_xor ::-1 -1 2 exit() exit for i in range(len(bin_A)):
    if i == 0:
        if (A - 1) % 4 == 1 or (A - 1) % 4 == 2:
            A_xor[i] = 1
    else:
        if ((A - 1) // pow(2, i)) % 2 == 1 and ((A - 1) % pow(2, i)) % 2 == 0:
            A_xor[i] = 1 i range(len(bin_A)) range len(bin_A) len bin_A if i == 0:
        if (A - 1) % 4 == 1 or (A - 1) % 4 == 2:
            A_xor[i] = 1
    else:
        if ((A - 1) // pow(2, i)) % 2 == 1 and ((A - 1) % pow(2, i)) % 2 == 0:
            A_xor[i] = 1 i == 0 i 0 if (A - 1) % 4 == 1 or (A - 1) % 4 == 2:
            A_xor[i] = 1
     (A - 1) % 4 == 1 or (A - 1) % 4 == 2 (A - 1) % 4 == 1 (A - 1) % 4 A - 1 A 1 4 1 (A - 1) % 4 == 2 (A - 1) % 4 A - 1 A 1 4 2 A_xor[i] = 1 A_xor[i] A_xor i 1 if ((A - 1) // pow(2, i)) % 2 == 1 and ((A - 1) % pow(2, i)) % 2 == 0:
            A_xor[i] = 1 ((A - 1) // pow(2, i)) % 2 == 1 and ((A - 1) % pow(2, i)) % 2 == 0 ((A - 1) // pow(2, i)) % 2 == 1 ((A - 1) // pow(2, i)) % 2 (A - 1) // pow(2, i) A - 1 A 1 pow(2, i) pow 2 i 2 1 ((A - 1) % pow(2, i)) % 2 == 0 ((A - 1) % pow(2, i)) % 2 (A - 1) % pow(2, i) A - 1 A 1 pow(2, i) pow 2 i 2 0 A_xor[i] = 1 A_xor[i] A_xor i 1 ans = [] ans [] for a, b in zip(A_xor, B_xor):
    if a != b:
        ans.append(1)
    else:
        ans.append(0) a b zip(A_xor, B_xor) zip A_xor B_xor if a != b:
        ans.append(1)
    else:
        ans.append(0) a != b a b ans.append(1) ans.append ans append 1 ans.append(0) ans.append ans append 0 print(int("".join(map(str, ans[::-1])), 2)) print int("".join(map(str, ans[::-1])), 2) int "".join(map(str, ans[::-1])) "".join "" join map(str, ans[::-1]) map str ans[::-1] ans ::-1 -1 2 A, B = map(int, input().split()) map(int, input().split()) A bin_A = bin(A - 1) bin(A - 1) bin_A A_xor = [0 for _ in range(len(bin_B) - 2)] [0 for _ in range(len(bin_B) - 2)] A_xor bin_B = bin(B) bin(B) bin_B ans = [] [] ans B = map(int, input().split()) map(int, input().split()) B B_xor = [0 for _ in range(len(bin_B) - 2)] [0 for _ in range(len(bin_B) - 2)] B_xor
A, B = map(int, input().split())
bin_A = bin(A - 1)
bin_B = bin(B)
A_xor = [0 for _ in range(len(bin_B) - 2)]
B_xor = [0 for _ in range(len(bin_B) - 2)]
for i in range(len(bin_B)):
    if i == 0:
        if B % 4 == 1 or B % 4 == 2:
            B_xor[i] = 1
    else:  
        if (B // pow(2, i)) % 2 == 1 and (B % pow(2, i)) % 2 == 0:
            B_xor[i] = 1
if A == 0:
    print(int("".join(map(str, B_xor[::-1])), 2))
    exit()
for i in range(len(bin_A)):
    if i == 0:
        if (A - 1) % 4 == 1 or (A - 1) % 4 == 2:
            A_xor[i] = 1
    else:
        if ((A - 1) // pow(2, i)) % 2 == 1 and ((A - 1) % pow(2, i)) % 2 == 0:
            A_xor[i] = 1
ans = []
for a, b in zip(A_xor, B_xor):
    if a != b:
        ans.append(1)
    else:
        ans.append(0)
print(int("".join(map(str, ans[::-1])), 2))