def g(N):
    if N%4==0:
        return N
    elif N%4==1:
        return 1
    elif N%4==2:
        return N+1
    else:
        return 0

def f(A,B):
    if A==0:
        return g(B)
    else:
        return g(A-1)^g(B)

A,B=map(int,input().split())
print(f(A,B)) def g(N):
    if N%4==0:
        return N
    elif N%4==1:
        return 1
    elif N%4==2:
        return N+1
    else:
        return 0 g if N%4==0:
        return N
    elif N%4==1:
        return 1
    elif N%4==2:
        return N+1
    else:
        return 0 N%4==0 N%4 N 4 0 return N N elif N%4==1:
        return 1
     N%4==1 N%4 N 4 1 return 1 1 elif N%4==2:
        return N+1
     N%4==2 N%4 N 4 2 return N+1 N+1 N 1 return 0 0 N N def f(A,B):
    if A==0:
        return g(B)
    else:
        return g(A-1)^g(B) f if A==0:
        return g(B)
    else:
        return g(A-1)^g(B) A==0 A 0 return g(B) g(B) g B return g(A-1)^g(B) g(A-1)^g(B) g(A-1) g A-1 A 1 g(B) g B A A B B A,B=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B print(f(A,B)) print f(A,B) f A B def f(A,B):
    if A==0:
        return g(B)
    else:
        return g(A-1)^g(B) def f(A,B):
    if A==0:
        return g(B)
    else:
        return g(A-1)^g(B) f A,B=map(int,input().split()) map(int,input().split()) A def g(N):
    if N%4==0:
        return N
    elif N%4==1:
        return 1
    elif N%4==2:
        return N+1
    else:
        return 0 def g(N):
    if N%4==0:
        return N
    elif N%4==1:
        return 1
    elif N%4==2:
        return N+1
    else:
        return 0 g B=map(int,input().split()) map(int,input().split()) B
def g(N):
    if N%4==0:
        return N
    elif N%4==1:
        return 1
    elif N%4==2:
        return N+1
    else:
        return 0

def f(A,B):
    if A==0:
        return g(B)
    else:
        return g(A-1)^g(B)

A,B=map(int,input().split())
print(f(A,B))