a, b = (int(_) for _ in input().split())

def xor(n):
    m = 0
    if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
    return (m)

A = xor(a - 1)
B = xor(b)
print(A ^ B) int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ a, b = (int(_) for _ in input().split()) a (int(_) for _ in input().split()) b def xor(n):
    m = 0
    if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
    return (m) xor m = 0 m 0 if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
     n % 4 == 0 n % 4 n 4 0 m = n m n elif (n % 4 == 1):
        m = 1
     n % 4 == 1 n % 4 n 4 1 m = 1 m 1 elif (n % 4 == 2):
        m = n + 1
     n % 4 == 2 n % 4 n 4 2 m = n + 1 m n + 1 n 1 return (m) m n n A = xor(a - 1) A xor(a - 1) xor a - 1 a 1 B = xor(b) B xor(b) xor b print(A ^ B) print A ^ B A B def xor(n):
    m = 0
    if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
    return (m) def xor(n):
    m = 0
    if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
    return (m) xor a, b = (int(_) for _ in input().split()) (int(_) for _ in input().split()) a A = xor(a - 1) xor(a - 1) A b = (int(_) for _ in input().split()) (int(_) for _ in input().split()) b B = xor(b) xor(b) B
a, b = (int(_) for _ in input().split())

def xor(n):
    m = 0
    if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
    return (m)

A = xor(a - 1)
B = xor(b)
print(A ^ B)
