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

def bina(x):
    if x % 2 == 1:
        if (x+1) % 4 == 2:
            return 1
        else:
            return 0
    else:
        return x ^ bina(x-1)
    
ans = bina(a-1) ^ bina(b)

print(ans) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def bina(x):
    if x % 2 == 1:
        if (x+1) % 4 == 2:
            return 1
        else:
            return 0
    else:
        return x ^ bina(x-1)
     bina if x % 2 == 1:
        if (x+1) % 4 == 2:
            return 1
        else:
            return 0
    else:
        return x ^ bina(x-1)
     x % 2 == 1 x % 2 x 2 1 if (x+1) % 4 == 2:
            return 1
        else:
            return 0
     (x+1) % 4 == 2 (x+1) % 4 x+1 x 1 4 2 return 1 1 return 0 0 return x ^ bina(x-1) x ^ bina(x-1) x bina(x-1) bina x-1 x 1 x x ans = bina(a-1) ^ bina(b) ans bina(a-1) ^ bina(b) bina(a-1) bina a-1 a 1 bina(b) bina b print(ans) print ans a,b = map(int,input().split()) map(int,input().split()) a ans = bina(a-1) ^ bina(b) bina(a-1) ^ bina(b) ans b = map(int,input().split()) map(int,input().split()) b def bina(x):
    if x % 2 == 1:
        if (x+1) % 4 == 2:
            return 1
        else:
            return 0
    else:
        return x ^ bina(x-1)
     def bina(x):
    if x % 2 == 1:
        if (x+1) % 4 == 2:
            return 1
        else:
            return 0
    else:
        return x ^ bina(x-1)
     bina
a,b = map(int,input().split())

def bina(x):
    if x % 2 == 1:
        if (x+1) % 4 == 2:
            return 1
        else:
            return 0
    else:
        return x ^ bina(x-1)
    
ans = bina(a-1) ^ bina(b)

print(ans)