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

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

A,B = map(int,input().split())
print(ruiseki_xor(B)^ruiseki_xor(A-1))