import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
a,b = rl()
c=a%4
d=b%4
ans=0
for i in range(4-c):
    ans^=a+i
for i in range(d+1):
    ans^=b-i
print(ans) import sys sys import time time import math math start=time.time() start time.time() time.time time time input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 inf = 10**18 inf 10**18 10 18 MOD = 1000000007 MOD 1000000007 ri = lambda : int(input()) ri lambda : int(input()) int(input()) int input() input rs = lambda : input().strip() rs lambda : input().strip() input().strip() ().strip () input strip rl = lambda : list(map(int, input().split())) rl lambda : list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split a,b = rl() a rl() rl b c=a%4 c a%4 a 4 d=b%4 d b%4 b 4 ans=0 ans 0 for i in range(4-c):
    ans^=a+i i range(4-c) range 4-c 4 c ans^=a+i ans a+i a i for i in range(d+1):
    ans^=b-i i range(d+1) range d+1 d 1 ans^=b-i ans b-i b i print(ans) print ans b = rl() rl() b ans^=a+i a+i ans ans^=b-i b-i ans rs = lambda : input().strip() lambda : input().strip() rs ri = lambda : int(input()) lambda : int(input()) ri c=a%4 a%4 c a,b = rl() rl() a MOD = 1000000007 1000000007 MOD rl = lambda : list(map(int, input().split())) lambda : list(map(int, input().split())) rl input = sys.stdin.readline sys.stdin.readline input ans=0 0 ans inf = 10**18 10**18 inf start=time.time() time.time() start d=b%4 b%4 d
import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
a,b = rl()
c=a%4
d=b%4
ans=0
for i in range(4-c):
    ans^=a+i
for i in range(d+1):
    ans^=b-i
print(ans)