def xor_array(n):
    if (n + 1) % 4 == 0:
        return 0
    elif (n + 1) % 2 == 0:
        return 1
    elif n % 4 == 0:
        return n
    else:
        return 1 ^ n


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


a, b = map(int, input().split())
print(xor_array(a - 1) ^ xor_array(b))
