from itertools import product
_ = input()
A = list(map(int, input().split()))
B = list(map(int, input().split()))
l = [a + b for a, b in product(A, B)]

if len(l) > len(set(l)):
    for i in l:
        if l.count(i) % 2 == 0:
            for _ in range(l.count(i)):
                l.remove(i)
        elif l.count(i) % 2 == 1 and l.count(i) > 1:
            for _ in range(l.count(i) - 1):
                l.remove(i)

xor = 0
for i in l:
    xor ^= i

print(xor)