A, B = gets.chomp.split(" ").map(&:to_i)

def f(x)
  if x == 1
    ret = 1
  elsif x.even?
    a = x / 2
    if a.even?
      ret = 0 ^ x
    else
      ret = 1 ^ x
    end
  else
    a = (x - 1) / 2
    if a.even?
      ret = 0
    else
      ret = 1
    end
  end
  ret
end

if A == B
  puts A
elsif A > 0
  puts f(A - 1) ^ f(B)
else
  puts f(B)
end
