a,b = map(int,input().split())
kazu = [a+i for i in range(4 - a%4)]
kazu.extend([b-i for i in range(b%4+1)])
ans = kazu[0]
for i in range(1,len(kazu)):
    ans = ans ^ kazu[i]
print(ans) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b a+i for i in range(4 - a%4) for i in range(4 - a%4) i range(4 - a%4) range 4 - a%4 4 a%4 a 4 for i in range(4 - a%4) a+i a i kazu = [a+i for i in range(4 - a%4)] kazu [a+i for i in range(4 - a%4)] b-i for i in range(b%4+1) for i in range(b%4+1) i range(b%4+1) range b%4+1 b%4 b 4 1 for i in range(b%4+1) b-i b i kazu.extend([b-i for i in range(b%4+1)]) kazu.extend kazu extend [b-i for i in range(b%4+1)] ans = kazu[0] ans kazu[0] kazu 0 for i in range(1,len(kazu)):
    ans = ans ^ kazu[i] i range(1,len(kazu)) range 1 len(kazu) len kazu ans = ans ^ kazu[i] ans ans ^ kazu[i] ans kazu[i] kazu i print(ans) print ans a,b = map(int,input().split()) map(int,input().split()) a kazu = [a+i for i in range(4 - a%4)] [a+i for i in range(4 - a%4)] kazu b = map(int,input().split()) map(int,input().split()) b ans = ans ^ kazu[i] ans ^ kazu[i] ans ans = kazu[0] kazu[0] ans
a,b = map(int,input().split())
kazu = [a+i for i in range(4 - a%4)]
kazu.extend([b-i for i in range(b%4+1)])
ans = kazu[0]
for i in range(1,len(kazu)):
    ans = ans ^ kazu[i]
print(ans)