program abc121d
  integer(8) a, b, x(0:3), y(0:3)
  read *, a, b
  if (a > 0) a = a - 1
  x = [a, 1_8, a + 1, 0_8]
  y = [b, 1_8, b + 1, 0_8]
  print *, xor(x(mod(a, 4)), y(mod(b, 4)))
end program abc121d
