from math import ceil
A, B = map(int, input().split())
res = 0
if B-A+1<=20:
    for a in range(A,B+1):
        res^=a
    print(res)
    exit()
for a in range(A,ceil(A/4)*4):
    res ^= a
for b in range((B//4)*4,B+1):
    res ^= b
print(res) from math import ceil A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B res = 0 res 0 if B-A+1<=20:
    for a in range(A,B+1):
        res^=a
    print(res)
    exit() B-A+1<=20 B-A+1 B-A B A 1 20 for a in range(A,B+1):
        res^=a
     a range(A,B+1) range A B+1 B 1 res^=a res a print(res) print res exit() exit for a in range(A,ceil(A/4)*4):
    res ^= a a range(A,ceil(A/4)*4) range A ceil(A/4)*4 ceil(A/4) ceil A/4 A 4 4 res ^= a res a for b in range((B//4)*4,B+1):
    res ^= b b range((B//4)*4,B+1) range (B//4)*4 B//4 B 4 4 B+1 B 1 res ^= b res b print(res) print res B = map(int, input().split()) map(int, input().split()) B res^=a a res A, B = map(int, input().split()) map(int, input().split()) A res = 0 0 res res ^= a a res res ^= b b res
from math import ceil
A, B = map(int, input().split())
res = 0
if B-A+1<=20:
    for a in range(A,B+1):
        res^=a
    print(res)
    exit()
for a in range(A,ceil(A/4)*4):
    res ^= a
for b in range((B//4)*4,B+1):
    res ^= b
print(res)