program abc121d
  integer(8) a, b
  read *, a, b
  if (a > 0) a = a - 1
  print *, xor(f(a), f(b))
contains
  recursive function f(n) result(res)
    integer(8), intent(in) :: n
    integer(8) res
    res = merge(n, xor(n, f(n - 1)), mod(n, 4) == 0)
  end function f
end program abc121d
