import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

A, B = mi()

ans = 0

def count(n):
    if n==0:
        return 0
    N = n
    n %= 4
    if n == 1:
        return 1
    if n == 2:
        return N+1
    if n == 3:
        return 0
    if n == 0:
        return N

print(count(A-1)^count(B)) import sys sys sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 def ii(): return int(sys.stdin.readline()) ii def mi(): return map(int, sys.stdin.readline().split()) mi def li(): return list(map(int, sys.stdin.readline().split())) li list(map(int, sys.stdin.readline().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] li2 N N [ini]*i for _ in range(j) for _ in range(j) _ range(j) range j for _ in range(j) [ini]*i [ini] ini i def dp2(ini, i, j): return [[ini]*i for _ in range(j)] dp2 ini ini i i j j [[ini]*i for _ in range(j)] for _ in range(k) for _ in range(k) _ range(k) range k for _ in range(k) [[ini]*i for _ in range(j)] def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A)) dp3 ini ini i i j j k k A, B = mi() A mi() mi B ans = 0 ans 0 def count(n):
    if n==0:
        return 0
    N = n
    n %= 4
    if n == 1:
        return 1
    if n == 2:
        return N+1
    if n == 3:
        return 0
    if n == 0:
        return N count if n==0:
        return 0
     n==0 n 0 return 0 0 N = n N n n %= 4 n 4 if n == 1:
        return 1
     n == 1 n 1 return 1 1 if n == 2:
        return N+1
     n == 2 n 2 return N+1 N+1 N 1 if n == 3:
        return 0
     n == 3 n 3 return 0 0 if n == 0:
        return N n == 0 n 0 return N N n n print(count(A-1)^count(B)) print count(A-1)^count(B) count(A-1) count A-1 A 1 count(B) count B def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A)) def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A)) dp3 B = mi() mi() B ans = 0 0 ans def dp2(ini, i, j): return [[ini]*i for _ in range(j)] def dp2(ini, i, j): return [[ini]*i for _ in range(j)] dp2 A, B = mi() mi() A def count(n):
    if n==0:
        return 0
    N = n
    n %= 4
    if n == 1:
        return 1
    if n == 2:
        return N+1
    if n == 3:
        return 0
    if n == 0:
        return N def count(n):
    if n==0:
        return 0
    N = n
    n %= 4
    if n == 1:
        return 1
    if n == 2:
        return N+1
    if n == 3:
        return 0
    if n == 0:
        return N count def ii(): return int(sys.stdin.readline()) def ii(): return int(sys.stdin.readline()) ii def li(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) li def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] li2 def mi(): return map(int, sys.stdin.readline().split()) def mi(): return map(int, sys.stdin.readline().split()) mi
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

A, B = mi()

ans = 0

def count(n):
    if n==0:
        return 0
    N = n
    n %= 4
    if n == 1:
        return 1
    if n == 2:
        return N+1
    if n == 3:
        return 0
    if n == 0:
        return N

print(count(A-1)^count(B))