a,b=map(int,input().split())

if a==b:
    print(a)
elif a%2==0 and b%2==1:
    if ((b+1-a)//2)%2==0:
        print(0)
    else:
        print(1)
elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(0^a)
    else:
        print(1^a)
elif a%2==0 and b%2==0:
    if ((b-a)//2)%2==0:
        print(0^b)
    else:
        print(1^b)
elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^0^b)
    else:
        print(a^1^b)
 a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if a==b:
    print(a)
elif a%2==0 and b%2==1:
    if ((b+1-a)//2)%2==0:
        print(0)
    else:
        print(1)
elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(0^a)
    else:
        print(1^a)
elif a%2==0 and b%2==0:
    if ((b-a)//2)%2==0:
        print(0^b)
    else:
        print(1^b)
elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^0^b)
    else:
        print(a^1^b) a==b a b print(a) print a elif a%2==0 and b%2==1:
    if ((b+1-a)//2)%2==0:
        print(0)
    else:
        print(1) a%2==0 and b%2==1 a%2==0 a%2 a 2 0 b%2==1 b%2 b 2 1 if ((b+1-a)//2)%2==0:
        print(0)
    else:
        print(1) ((b+1-a)//2)%2==0 ((b+1-a)//2)%2 (b+1-a)//2 b+1-a b+1 b 1 a 2 2 0 print(0) print 0 print(1) print 1 elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(0^a)
    else:
        print(1^a) a%2==1 and b%2==1 a%2==1 a%2 a 2 1 b%2==1 b%2 b 2 1 if ((b-a)//2)%2==0:
        print(0^a)
    else:
        print(1^a) ((b-a)//2)%2==0 ((b-a)//2)%2 (b-a)//2 b-a b a 2 2 0 print(0^a) print 0^a 0 a print(1^a) print 1^a 1 a elif a%2==0 and b%2==0:
    if ((b-a)//2)%2==0:
        print(0^b)
    else:
        print(1^b) a%2==0 and b%2==0 a%2==0 a%2 a 2 0 b%2==0 b%2 b 2 0 if ((b-a)//2)%2==0:
        print(0^b)
    else:
        print(1^b) ((b-a)//2)%2==0 ((b-a)//2)%2 (b-a)//2 b-a b a 2 2 0 print(0^b) print 0^b 0 b print(1^b) print 1^b 1 b elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^0^b)
    else:
        print(a^1^b) a%2==1 and b%2==0 a%2==1 a%2 a 2 1 b%2==0 b%2 b 2 0 if ((b-a-1)//2)%2==0:
        print(a^0^b)
    else:
        print(a^1^b) ((b-a-1)//2)%2==0 ((b-a-1)//2)%2 (b-a-1)//2 b-a-1 b-a b a 1 2 2 0 print(a^0^b) print a^0^b a^0 a 0 b print(a^1^b) print a^1^b a^1 a 1 b a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b
a,b=map(int,input().split())

if a==b:
    print(a)
elif a%2==0 and b%2==1:
    if ((b+1-a)//2)%2==0:
        print(0)
    else:
        print(1)
elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(0^a)
    else:
        print(1^a)
elif a%2==0 and b%2==0:
    if ((b-a)//2)%2==0:
        print(0^b)
    else:
        print(1^b)
elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^0^b)
    else:
        print(a^1^b)

