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

res = []
if b - a < 10
  res = (a..b).to_a
else
  loop do
    res << a
    a += 1
    break if a % 4 == 0
  end

  if b % 4 == 0
    res << b
  else
    loop do
      res << b
      break if b % 4 == 0
      b -= 1
    end
  end
end

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

puts ans
