a,b = gets.split(" ").map(&:to_i)
a = a-1
t = 0

if a % 2 == 0
  if (a/2) % 2 == 0
    t = 0
  else
    t = 1
  end
  a = a ^ t
else
  if ((a+1)/2) % 2 == 0
    a = 0
  else
    a = 1
  end
end

if b % 2 == 0
  if (b/2) % 2 == 0
    t = 0
  else
    t = 1
  end
  b = b ^ t
else
  if ((b+1)/2) % 2 == 0
    b = 0
  else
    b = 1
  end
end

ans = a ^ b

puts ans


