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

ans = 0
if a.even?
  if a == b
    ans = 0
  else
    m = a
    if b >= a + 4
      m = a + (b / 4) * 4
    end
    for i in m..b do
      ans ^= i
    end
  end
else
  if a == b
    ans = 0
  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
end

puts ans
