A, B = map(int, input().split())
xorA = [0] * 41
xorB = [0] * 41
def xor_list(l, N):
    k = 1
    while 2 ** k // 2 <= N:
        tmp = (N+1) % (2 ** k)
        if k == 1:
            l[k-1] = (N+1) // (2 ** k)
            k += 1
        elif tmp <= 2 ** k // 2:
            k += 1
            continue
        else:
            l[k-1] = (tmp - 2 ** k // 2) % 2
            k += 1
        if k == 1:
            count = (N + 1) // (2 ** k) + tmp + 1
            l[0] = (count % 2)
xor_list(xorA, A-1)
xor_list(xorB, B)
ans = 0
for i in range(41):
    ans += abs(xorA[i] - xorB[i]) % 2 * (2 ** i)
print(ans) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B xorA = [0] * 41 xorA [0] * 41 [0] 0 41 xorB = [0] * 41 xorB [0] * 41 [0] 0 41 def xor_list(l, N):
    k = 1
    while 2 ** k // 2 <= N:
        tmp = (N+1) % (2 ** k)
        if k == 1:
            l[k-1] = (N+1) // (2 ** k)
            k += 1
        elif tmp <= 2 ** k // 2:
            k += 1
            continue
        else:
            l[k-1] = (tmp - 2 ** k // 2) % 2
            k += 1
        if k == 1:
            count = (N + 1) // (2 ** k) + tmp + 1
            l[0] = (count % 2) xor_list k = 1 k 1 while 2 ** k // 2 <= N:
        tmp = (N+1) % (2 ** k)
        if k == 1:
            l[k-1] = (N+1) // (2 ** k)
            k += 1
        elif tmp <= 2 ** k // 2:
            k += 1
            continue
        else:
            l[k-1] = (tmp - 2 ** k // 2) % 2
            k += 1
        if k == 1:
            count = (N + 1) // (2 ** k) + tmp + 1
            l[0] = (count % 2) 2 ** k // 2 <= N 2 ** k // 2 2 ** k 2 k 2 N tmp = (N+1) % (2 ** k) tmp (N+1) % (2 ** k) N+1 N 1 2 ** k 2 k if k == 1:
            l[k-1] = (N+1) // (2 ** k)
            k += 1
        elif tmp <= 2 ** k // 2:
            k += 1
            continue
        else:
            l[k-1] = (tmp - 2 ** k // 2) % 2
            k += 1
         k == 1 k 1 l[k-1] = (N+1) // (2 ** k) l[k-1] l k-1 k 1 (N+1) // (2 ** k) N+1 N 1 2 ** k 2 k k += 1 k 1 elif tmp <= 2 ** k // 2:
            k += 1
            continue
         tmp <= 2 ** k // 2 tmp 2 ** k // 2 2 ** k 2 k 2 k += 1 k 1 continue l[k-1] = (tmp - 2 ** k // 2) % 2 l[k-1] l k-1 k 1 (tmp - 2 ** k // 2) % 2 tmp - 2 ** k // 2 tmp 2 ** k // 2 2 ** k 2 k 2 2 k += 1 k 1 if k == 1:
            count = (N + 1) // (2 ** k) + tmp + 1
            l[0] = (count % 2) k == 1 k 1 count = (N + 1) // (2 ** k) + tmp + 1 count (N + 1) // (2 ** k) + tmp + 1 (N + 1) // (2 ** k) + tmp (N + 1) // (2 ** k) N + 1 N 1 2 ** k 2 k tmp 1 l[0] = (count % 2) l[0] l 0 count % 2 count 2 l l N N xor_list(xorA, A-1) xor_list xorA A-1 A 1 xor_list(xorB, B) xor_list xorB B ans = 0 ans 0 for i in range(41):
    ans += abs(xorA[i] - xorB[i]) % 2 * (2 ** i) i range(41) range 41 ans += abs(xorA[i] - xorB[i]) % 2 * (2 ** i) ans abs(xorA[i] - xorB[i]) % 2 * (2 ** i) abs(xorA[i] - xorB[i]) % 2 abs(xorA[i] - xorB[i]) abs xorA[i] - xorB[i] xorA[i] xorA i xorB[i] xorB i 2 2 ** i 2 i print(ans) print ans xorA = [0] * 41 [0] * 41 xorA def xor_list(l, N):
    k = 1
    while 2 ** k // 2 <= N:
        tmp = (N+1) % (2 ** k)
        if k == 1:
            l[k-1] = (N+1) // (2 ** k)
            k += 1
        elif tmp <= 2 ** k // 2:
            k += 1
            continue
        else:
            l[k-1] = (tmp - 2 ** k // 2) % 2
            k += 1
        if k == 1:
            count = (N + 1) // (2 ** k) + tmp + 1
            l[0] = (count % 2) def xor_list(l, N):
    k = 1
    while 2 ** k // 2 <= N:
        tmp = (N+1) % (2 ** k)
        if k == 1:
            l[k-1] = (N+1) // (2 ** k)
            k += 1
        elif tmp <= 2 ** k // 2:
            k += 1
            continue
        else:
            l[k-1] = (tmp - 2 ** k // 2) % 2
            k += 1
        if k == 1:
            count = (N + 1) // (2 ** k) + tmp + 1
            l[0] = (count % 2) xor_list xorB = [0] * 41 [0] * 41 xorB B = map(int, input().split()) map(int, input().split()) B ans += abs(xorA[i] - xorB[i]) % 2 * (2 ** i) abs(xorA[i] - xorB[i]) % 2 * (2 ** i) ans A, B = map(int, input().split()) map(int, input().split()) A ans = 0 0 ans
A, B = map(int, input().split())
xorA = [0] * 41
xorB = [0] * 41
def xor_list(l, N):
    k = 1
    while 2 ** k // 2 <= N:
        tmp = (N+1) % (2 ** k)
        if k == 1:
            l[k-1] = (N+1) // (2 ** k)
            k += 1
        elif tmp <= 2 ** k // 2:
            k += 1
            continue
        else:
            l[k-1] = (tmp - 2 ** k // 2) % 2
            k += 1
        if k == 1:
            count = (N + 1) // (2 ** k) + tmp + 1
            l[0] = (count % 2)
xor_list(xorA, A-1)
xor_list(xorB, B)
ans = 0
for i in range(41):
    ans += abs(xorA[i] - xorB[i]) % 2 * (2 ** i)
print(ans)