def f(n):
    num=n%4
    if num==0:return n
    elif num==1:return 1
    elif num==2:return n+1
    else:return 0


a,b=map(int,input().split())
print(f(a-1)^f(b)) def f(n):
    num=n%4
    if num==0:return n
    elif num==1:return 1
    elif num==2:return n+1
    else:return 0 f num=n%4 num n%4 n 4 if num==0:return n
    elif num==1:return 1
    elif num==2:return n+1
    else:return 0 num==0 num 0 elif num==1:return 1
     num==1 num 1 elif num==2:return n+1
     num==2 num 2 n n a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b print(f(a-1)^f(b)) print f(a-1)^f(b) f(a-1) f a-1 a 1 f(b) f b def f(n):
    num=n%4
    if num==0:return n
    elif num==1:return 1
    elif num==2:return n+1
    else:return 0 def f(n):
    num=n%4
    if num==0:return n
    elif num==1:return 1
    elif num==2:return n+1
    else:return 0 f a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b
def f(n):
    num=n%4
    if num==0:return n
    elif num==1:return 1
    elif num==2:return n+1
    else:return 0


a,b=map(int,input().split())
print(f(a-1)^f(b))