a, b = gets.split.map(&:to_i)

ans = 0
if a.even?
  m = a
  if b >= a + 4
    m = a + (b / 4) * 4
  end
  for i in m..b do
    ans ^= i
  end
else
  m = a
  if b >= a + 4 + 4
    m = ((b / 4) - 1) * 4
    ans = a
  end
  # puts m
  # ans = 3
  # b = [b, m+1].min
  # puts m
  # puts b
  for i in m..b do
    ans ^= i
  end
end

puts ans