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

if a == b:
    print(a)
    exit()
cnt = b - a + 1
cnt -= (a % 2 == 1) + (b % 2 == 0)
a, b = a * (a % 2 == 1), b * (b % 2 == 0)
if cnt // 2 % 2 == 0:
    print(0 ^ a ^ b)
elif cnt // 2 % 2 == 1:
    print(1 ^ a ^ b) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b if a == b:
    print(a)
    exit() a == b a b print(a) print a exit() exit cnt = b - a + 1 cnt b - a + 1 b - a b a 1 cnt -= (a % 2 == 1) + (b % 2 == 0) cnt (a % 2 == 1) + (b % 2 == 0) a % 2 == 1 a % 2 a 2 1 b % 2 == 0 b % 2 b 2 0 a, b = a * (a % 2 == 1), b * (b % 2 == 0) a a * (a % 2 == 1) a a % 2 == 1 a % 2 a 2 1 b b * (b % 2 == 0) b b % 2 == 0 b % 2 b 2 0 if cnt // 2 % 2 == 0:
    print(0 ^ a ^ b)
elif cnt // 2 % 2 == 1:
    print(1 ^ a ^ b) cnt // 2 % 2 == 0 cnt // 2 % 2 cnt // 2 cnt 2 2 0 print(0 ^ a ^ b) print 0 ^ a ^ b 0 ^ a 0 a b elif cnt // 2 % 2 == 1:
    print(1 ^ a ^ b) cnt // 2 % 2 == 1 cnt // 2 % 2 cnt // 2 cnt 2 2 1 print(1 ^ a ^ b) print 1 ^ a ^ b 1 ^ a 1 a b cnt = b - a + 1 b - a + 1 cnt a, b = a * (a % 2 == 1), b * (b % 2 == 0) a * (a % 2 == 1) a a, b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b b = a * (a % 2 == 1), b * (b % 2 == 0) b * (b % 2 == 0) b cnt -= (a % 2 == 1) + (b % 2 == 0) (a % 2 == 1) + (b % 2 == 0) cnt
a, b = map(int, input().split())

if a == b:
    print(a)
    exit()
cnt = b - a + 1
cnt -= (a % 2 == 1) + (b % 2 == 0)
a, b = a * (a % 2 == 1), b * (b % 2 == 0)
if cnt // 2 % 2 == 0:
    print(0 ^ a ^ b)
elif cnt // 2 % 2 == 1:
    print(1 ^ a ^ b)
