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

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

if a == 0:
    print(xor_sum(b))
else:
    print(xor_sum(a-1) ^ xor_sum(b)) a, b = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b def xor_sum(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return n+1
    elif n % 4 == 3:
        return 0
    else:
        return n xor_sum if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return n+1
    elif n % 4 == 3:
        return 0
    else:
        return n 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 elif n % 4 == 3:
        return 0
     n % 4 == 3 n % 4 n 4 3 return 0 0 return n n n n if a == 0:
    print(xor_sum(b))
else:
    print(xor_sum(a-1) ^ xor_sum(b)) a == 0 a 0 print(xor_sum(b)) print xor_sum(b) xor_sum b print(xor_sum(a-1) ^ xor_sum(b)) print xor_sum(a-1) ^ xor_sum(b) xor_sum(a-1) xor_sum a-1 a 1 xor_sum(b) xor_sum b def xor_sum(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return n+1
    elif n % 4 == 3:
        return 0
    else:
        return n def xor_sum(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return n+1
    elif n % 4 == 3:
        return 0
    else:
        return n xor_sum a, b = list(map(int, input().split())) list(map(int, input().split())) a b = list(map(int, input().split())) list(map(int, input().split())) b
a, b = list(map(int, input().split()))

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

if a == 0:
    print(xor_sum(b))
else:
    print(xor_sum(a-1) ^ xor_sum(b))