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