import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    A,B = NMI()
    
    xA , xB = 0,0
    
    if A == 0 or A == 1:
        xA = 0
    else:
        if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
    if B == 0:
        xB = 0
    else:
        if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
    A_bin = format(xA, '040b')
    B_bin = format(xB, '040b')
    
    ans = ['0' for _ in range(40)]
    
    for i in range(39,-1,-1):
        if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
    print(int("".join(ans),2))
        
    ###################ここに処理を書く################

if __name__ == '__main__':
    main() import sys sys import math math import itertools itertools import collections collections from collections import deque sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 input = lambda: sys.stdin.readline().strip() input lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip NI = lambda: int(input()) NI lambda: int(input()) int(input()) int input() input NMI = lambda: map(int, input().split()) NMI lambda: map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split NLI = lambda: list(NMI()) NLI lambda: list(NMI()) list(NMI()) list NMI() NMI SI = lambda: input() SI lambda: input() input() input def main():
    A,B = NMI()
    
    xA , xB = 0,0
    
    if A == 0 or A == 1:
        xA = 0
    else:
        if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
    if B == 0:
        xB = 0
    else:
        if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
    A_bin = format(xA, '040b')
    B_bin = format(xB, '040b')
    
    ans = ['0' for _ in range(40)]
    
    for i in range(39,-1,-1):
        if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
    print(int("".join(ans),2))
        
    ###################ここに処理を書く################ main A,B = NMI() A NMI() NMI B xA , xB = 0,0 xA 0 xB 0 if A == 0 or A == 1:
        xA = 0
    else:
        if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
     A == 0 or A == 1 A == 0 A 0 A == 1 A 1 xA = 0 xA 0 if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
     A % 4 == 1 A % 4 A 4 1 xA = A - 1 xA A - 1 A 1 elif A % 4 == 2:
            xA = 1
         A % 4 == 2 A % 4 A 4 2 xA = 1 xA 1 elif A % 4 == 3:
            xA = A
         A % 4 == 3 A % 4 A 4 3 xA = A xA A xA = 0 xA 0 if B == 0:
        xB = 0
    else:
        if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
     B == 0 B 0 xB = 0 xB 0 if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
     B % 4 == 1 B % 4 B 4 1 xB = 1 xB 1 elif B % 4 == 2:
            xB = B + 1
         B % 4 == 2 B % 4 B 4 2 xB = B + 1 xB B + 1 B 1 elif B % 4 == 3:
            xB = 0
         B % 4 == 3 B % 4 B 4 3 xB = 0 xB 0 xB = B xB B A_bin = format(xA, '040b') A_bin format(xA, '040b') format xA '040b' B_bin = format(xB, '040b') B_bin format(xB, '040b') format xB '040b' '0' for _ in range(40) for _ in range(40) _ range(40) range 40 for _ in range(40) '0' ans = ['0' for _ in range(40)] ans ['0' for _ in range(40)] for i in range(39,-1,-1):
        if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
     i range(39,-1,-1) range 39 -1 -1 if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
     int(A_bin[i])+int(B_bin[i])==1 int(A_bin[i])+int(B_bin[i]) int(A_bin[i]) int A_bin[i] A_bin i int(B_bin[i]) int B_bin[i] B_bin i 1 ans[i] = '1' ans[i] ans i '1' print(int("".join(ans),2)) print int("".join(ans),2) int "".join(ans) "".join "" join ans 2 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main NLI = lambda: list(NMI()) lambda: list(NMI()) NLI MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD SI = lambda: input() lambda: input() SI input = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() input NMI = lambda: map(int, input().split()) lambda: map(int, input().split()) NMI NI = lambda: int(input()) lambda: int(input()) NI def main():
    A,B = NMI()
    
    xA , xB = 0,0
    
    if A == 0 or A == 1:
        xA = 0
    else:
        if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
    if B == 0:
        xB = 0
    else:
        if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
    A_bin = format(xA, '040b')
    B_bin = format(xB, '040b')
    
    ans = ['0' for _ in range(40)]
    
    for i in range(39,-1,-1):
        if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
    print(int("".join(ans),2))
        
    ###################ここに処理を書く################ def main():
    A,B = NMI()
    
    xA , xB = 0,0
    
    if A == 0 or A == 1:
        xA = 0
    else:
        if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
    if B == 0:
        xB = 0
    else:
        if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
    A_bin = format(xA, '040b')
    B_bin = format(xB, '040b')
    
    ans = ['0' for _ in range(40)]
    
    for i in range(39,-1,-1):
        if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
    print(int("".join(ans),2))
        
    ###################ここに処理を書く################ main
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    A,B = NMI()
    
    xA , xB = 0,0
    
    if A == 0 or A == 1:
        xA = 0
    else:
        if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
    if B == 0:
        xB = 0
    else:
        if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
    A_bin = format(xA, '040b')
    B_bin = format(xB, '040b')
    
    ans = ['0' for _ in range(40)]
    
    for i in range(39,-1,-1):
        if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
    print(int("".join(ans),2))
        
    ###################ここに処理を書く################

if __name__ == '__main__':
    main()