[A,B] = list(map(int,input().split()))
X = B-A

if A%2 == 0:
    if X%4 ==1:
        out=1
    elif X%4 ==2:
        out=1^B
    elif X%4 ==3:
        out=0
    else:
        out=B

else:
    if X%4 ==1:
        out=A^B
    elif X%4 ==2:
        out=A^1
    elif X%4 ==3:
        out=A^B^1
    else:
        out=A

print(out) [A,B] = list(map(int,input().split())) [A,B] A B list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split X = B-A X B-A B A if A%2 == 0:
    if X%4 ==1:
        out=1
    elif X%4 ==2:
        out=1^B
    elif X%4 ==3:
        out=0
    else:
        out=B

else:
    if X%4 ==1:
        out=A^B
    elif X%4 ==2:
        out=A^1
    elif X%4 ==3:
        out=A^B^1
    else:
        out=A A%2 == 0 A%2 A 2 0 if X%4 ==1:
        out=1
    elif X%4 ==2:
        out=1^B
    elif X%4 ==3:
        out=0
    else:
        out=B X%4 ==1 X%4 X 4 1 out=1 out 1 elif X%4 ==2:
        out=1^B
     X%4 ==2 X%4 X 4 2 out=1^B out 1^B 1 B elif X%4 ==3:
        out=0
     X%4 ==3 X%4 X 4 3 out=0 out 0 out=B out B if X%4 ==1:
        out=A^B
    elif X%4 ==2:
        out=A^1
    elif X%4 ==3:
        out=A^B^1
    else:
        out=A X%4 ==1 X%4 X 4 1 out=A^B out A^B A B elif X%4 ==2:
        out=A^1
     X%4 ==2 X%4 X 4 2 out=A^1 out A^1 A 1 elif X%4 ==3:
        out=A^B^1
     X%4 ==3 X%4 X 4 3 out=A^B^1 out A^B^1 A^B A B 1 out=A out A print(out) print out X = B-A B-A X out=A A out out=A^B A^B out out=1^B 1^B out out=0 0 out out=1 1 out out=A^B^1 A^B^1 out out=A^1 A^1 out out=B B out
[A,B] = list(map(int,input().split()))
X = B-A

if A%2 == 0:
    if X%4 ==1:
        out=1
    elif X%4 ==2:
        out=1^B
    elif X%4 ==3:
        out=0
    else:
        out=B

else:
    if X%4 ==1:
        out=A^B
    elif X%4 ==2:
        out=A^1
    elif X%4 ==3:
        out=A^B^1
    else:
        out=A

print(out)
