#
#https://www.youtube.com/watch?v=igfVeTsGeYw
#https://atcoder.jp/contests/abc121/tasks/abc121_d
#
import numpy as np
import sys

input = sys.stdin.readline

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

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

if A!=0:A-=1

print(calc(A)^(calc(B)))
 import numpy as np numpy import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B def calc(x):
    if (x+1)%4 == 0:
        return 0
    elif (x+1)%4 == 1:
        return x
    elif (x+1)%4 == 2:
        return (x-1)^x
    else:
        return (x-2)^(x-1)^x calc if (x+1)%4 == 0:
        return 0
    elif (x+1)%4 == 1:
        return x
    elif (x+1)%4 == 2:
        return (x-1)^x
    else:
        return (x-2)^(x-1)^x (x+1)%4 == 0 (x+1)%4 x+1 x 1 4 0 return 0 0 elif (x+1)%4 == 1:
        return x
     (x+1)%4 == 1 (x+1)%4 x+1 x 1 4 1 return x x elif (x+1)%4 == 2:
        return (x-1)^x
     (x+1)%4 == 2 (x+1)%4 x+1 x 1 4 2 return (x-1)^x (x-1)^x x-1 x 1 x return (x-2)^(x-1)^x (x-2)^(x-1)^x (x-2)^(x-1) x-2 x 2 x-1 x 1 x x x if A!=0:A-=1 A!=0 A 0 print(calc(A)^(calc(B))) print calc(A)^(calc(B)) calc(A) calc A calc(B) calc B B = map(int,input().split()) map(int,input().split()) B A,B = map(int,input().split()) map(int,input().split()) A input = sys.stdin.readline sys.stdin.readline input def calc(x):
    if (x+1)%4 == 0:
        return 0
    elif (x+1)%4 == 1:
        return x
    elif (x+1)%4 == 2:
        return (x-1)^x
    else:
        return (x-2)^(x-1)^x def calc(x):
    if (x+1)%4 == 0:
        return 0
    elif (x+1)%4 == 1:
        return x
    elif (x+1)%4 == 2:
        return (x-1)^x
    else:
        return (x-2)^(x-1)^x calc
#
#https://www.youtube.com/watch?v=igfVeTsGeYw
#https://atcoder.jp/contests/abc121/tasks/abc121_d
#
import numpy as np
import sys

input = sys.stdin.readline

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

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

if A!=0:A-=1

print(calc(A)^(calc(B)))

