#!/usr/bin/env python3

a, b = list(map(int, input().split()))

if b-a == 0:
    print(a)
    exit()
if b-a == 1:
    print(a ^ b)
    exit()

list_ = []
ans = 0
if a % 2 != 0:
    list_.append(a)
    a += 1

if b % 2 == 0:
    list_.append(b)
    b -= 1

num = ((b+1)-a)//2
if num % 2 == 0:
    ans = 0
else:
    ans = 1


for i in list_:
    ans = ans ^ i
print(ans) a, b = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b if b-a == 0:
    print(a)
    exit() b-a == 0 b-a b a 0 print(a) print a exit() exit if b-a == 1:
    print(a ^ b)
    exit() b-a == 1 b-a b a 1 print(a ^ b) print a ^ b a b exit() exit list_ = [] list_ [] ans = 0 ans 0 if a % 2 != 0:
    list_.append(a)
    a += 1 a % 2 != 0 a % 2 a 2 0 list_.append(a) list_.append list_ append a a += 1 a 1 if b % 2 == 0:
    list_.append(b)
    b -= 1 b % 2 == 0 b % 2 b 2 0 list_.append(b) list_.append list_ append b b -= 1 b 1 num = ((b+1)-a)//2 num ((b+1)-a)//2 (b+1)-a b+1 b 1 a 2 if num % 2 == 0:
    ans = 0
else:
    ans = 1 num % 2 == 0 num % 2 num 2 0 ans = 0 ans 0 ans = 1 ans 1 for i in list_:
    ans = ans ^ i i list_ ans = ans ^ i ans ans ^ i ans i print(ans) print ans num = ((b+1)-a)//2 ((b+1)-a)//2 num ans = 0 0 ans ans = 0 0 ans ans = ans ^ i ans ^ i ans a += 1 1 a ans = 1 1 ans a, b = list(map(int, input().split())) list(map(int, input().split())) a b = list(map(int, input().split())) list(map(int, input().split())) b list_ = [] [] list_ b -= 1 1 b
#!/usr/bin/env python3

a, b = list(map(int, input().split()))

if b-a == 0:
    print(a)
    exit()
if b-a == 1:
    print(a ^ b)
    exit()

list_ = []
ans = 0
if a % 2 != 0:
    list_.append(a)
    a += 1

if b % 2 == 0:
    list_.append(b)
    b -= 1

num = ((b+1)-a)//2
if num % 2 == 0:
    ans = 0
else:
    ans = 1


for i in list_:
    ans = ans ^ i
print(ans)
