# 偶数a ^ (a + 1)　は必ず1になる
# 従い、0 〜 4の倍数 - 1でXORは0になる

import sys
readline = sys.stdin.readline

A,B = map(int,readline().split())

def f(x):
  res = 0
  while x % 4 != 3:
    res ^= x
    x -= 1
  return res

print(f(A - 1) ^ f(B)) import sys sys readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline A,B = map(int,readline().split()) A map(int,readline().split()) map int readline().split() ().split () readline split B def f(x):
  res = 0
  while x % 4 != 3:
    res ^= x
    x -= 1
  return res f res = 0 res 0 while x % 4 != 3:
    res ^= x
    x -= 1
   x % 4 != 3 x % 4 x 4 3 res ^= x res x x -= 1 x 1 return res res x x print(f(A - 1) ^ f(B)) print f(A - 1) ^ f(B) f(A - 1) f A - 1 A 1 f(B) f B def f(x):
  res = 0
  while x % 4 != 3:
    res ^= x
    x -= 1
  return res def f(x):
  res = 0
  while x % 4 != 3:
    res ^= x
    x -= 1
  return res f A,B = map(int,readline().split()) map(int,readline().split()) A B = map(int,readline().split()) map(int,readline().split()) B readline = sys.stdin.readline sys.stdin.readline readline
# 偶数a ^ (a + 1)　は必ず1になる
# 従い、0 〜 4の倍数 - 1でXORは0になる

import sys
readline = sys.stdin.readline

A,B = map(int,readline().split())

def f(x):
  res = 0
  while x % 4 != 3:
    res ^= x
    x -= 1
  return res

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