a, b = $stdin.readline.split(" ").map(&:to_i)

res = []
if b - a < 10
  res = (a..b).to_a
else
  if a & 3 == 0
    res << a
  else
    while a & 3 != 0
      res << a
      a += 1
    end
  end

  if b & 3 == 0
    res << b
  else
    while b & 3 != 0
      res << b
      b -= 1
    end
  end
end
ans = 0

res.each do |x|
  ans ^= x
end

puts ans
