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

if(A % 2 == 0)
  case ((B-A) % 4)
  when 1 then
    p 1
  when 2 then
    p 1 ^ B
  when 3 then
    p 0
  when 0 then
    p B
  end
else
  case ((B-A) % 4)
  when 1 then
    p A ^ B
  when 2 then
    p A ^ 1
  when 3 then
    p A ^ 1 ^ B
  when 0 then
    p A
  end
end
