A, B = map(int, input().split())
# a = A
# if A == B:
#     print(A)
#     exit(0)
# if A != 0:
#     a = A - 1
# if a % 2 != 0:
#     a = a ^ (a - 1)
#     t = (a - 1) // 2
#     if t % 2 != 0:
#         a = a ^ 1
# else:
#     t = A // 2
#     if t % 2 != 0:
#         a = a ^ 1
#
# if B % 2 != 0:
#     B = B ^ (B - 1)
#     t = (B - 1) // 2
#     if t % 2 != 0:
#         B = B ^ 1
# else:
#     t = B // 2
#     if t % 2 != 0:
#         B = B ^ 1
# ans = a ^ B
def calc(a):
    t = (a + 1) // 2
    ans = t % 2
    if a % 2 == 0:
        ans = ans ^ a
    return ans

print(calc(A-1) ^ calc(B)) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def calc(a):
    t = (a + 1) // 2
    ans = t % 2
    if a % 2 == 0:
        ans = ans ^ a
    return ans calc t = (a + 1) // 2 t (a + 1) // 2 a + 1 a 1 2 ans = t % 2 ans t % 2 t 2 if a % 2 == 0:
        ans = ans ^ a
     a % 2 == 0 a % 2 a 2 0 ans = ans ^ a ans ans ^ a ans a return ans ans a a print(calc(A-1) ^ calc(B)) print calc(A-1) ^ calc(B) calc(A-1) calc A-1 A 1 calc(B) calc B B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A def calc(a):
    t = (a + 1) // 2
    ans = t % 2
    if a % 2 == 0:
        ans = ans ^ a
    return ans def calc(a):
    t = (a + 1) // 2
    ans = t % 2
    if a % 2 == 0:
        ans = ans ^ a
    return ans calc
A, B = map(int, input().split())
# a = A
# if A == B:
#     print(A)
#     exit(0)
# if A != 0:
#     a = A - 1
# if a % 2 != 0:
#     a = a ^ (a - 1)
#     t = (a - 1) // 2
#     if t % 2 != 0:
#         a = a ^ 1
# else:
#     t = A // 2
#     if t % 2 != 0:
#         a = a ^ 1
#
# if B % 2 != 0:
#     B = B ^ (B - 1)
#     t = (B - 1) // 2
#     if t % 2 != 0:
#         B = B ^ 1
# else:
#     t = B // 2
#     if t % 2 != 0:
#         B = B ^ 1
# ans = a ^ B
def calc(a):
    t = (a + 1) // 2
    ans = t % 2
    if a % 2 == 0:
        ans = ans ^ a
    return ans

print(calc(A-1) ^ calc(B))
