import sys
sys.setrecursionlimit(10**6)

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

def rep_xor(x):
    if x%4 == 0:
        return 0^x
    elif x%4 == 1:
        return 1
    elif x%4 == 2:
        return 1^x
    else:
        return 0

if a > 0:
    fa = rep_xor(a-1)
    fb = rep_xor(b)
    ans = fa^fb
else:
    fb = rep_xor(b)
    ans = fb

print(ans) import sys sys sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def rep_xor(x):
    if x%4 == 0:
        return 0^x
    elif x%4 == 1:
        return 1
    elif x%4 == 2:
        return 1^x
    else:
        return 0 rep_xor if x%4 == 0:
        return 0^x
    elif x%4 == 1:
        return 1
    elif x%4 == 2:
        return 1^x
    else:
        return 0 x%4 == 0 x%4 x 4 0 return 0^x 0^x 0 x elif x%4 == 1:
        return 1
     x%4 == 1 x%4 x 4 1 return 1 1 elif x%4 == 2:
        return 1^x
     x%4 == 2 x%4 x 4 2 return 1^x 1^x 1 x return 0 0 x x if a > 0:
    fa = rep_xor(a-1)
    fb = rep_xor(b)
    ans = fa^fb
else:
    fb = rep_xor(b)
    ans = fb a > 0 a 0 fa = rep_xor(a-1) fa rep_xor(a-1) rep_xor a-1 a 1 fb = rep_xor(b) fb rep_xor(b) rep_xor b ans = fa^fb ans fa^fb fa fb fb = rep_xor(b) fb rep_xor(b) rep_xor b ans = fb ans fb print(ans) print ans fb = rep_xor(b) rep_xor(b) fb fb = rep_xor(b) rep_xor(b) fb a, b = map(int, input().split()) map(int, input().split()) a ans = fa^fb fa^fb ans ans = fb fb ans b = map(int, input().split()) map(int, input().split()) b def rep_xor(x):
    if x%4 == 0:
        return 0^x
    elif x%4 == 1:
        return 1
    elif x%4 == 2:
        return 1^x
    else:
        return 0 def rep_xor(x):
    if x%4 == 0:
        return 0^x
    elif x%4 == 1:
        return 1
    elif x%4 == 2:
        return 1^x
    else:
        return 0 rep_xor fa = rep_xor(a-1) rep_xor(a-1) fa
import sys
sys.setrecursionlimit(10**6)

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

def rep_xor(x):
    if x%4 == 0:
        return 0^x
    elif x%4 == 1:
        return 1
    elif x%4 == 2:
        return 1^x
    else:
        return 0

if a > 0:
    fa = rep_xor(a-1)
    fb = rep_xor(b)
    ans = fa^fb
else:
    fb = rep_xor(b)
    ans = fb

print(ans)