import Data.Bits (xor)

f0 x
  | x`mod`4==0 = x
  | x`mod`4==1 = 1
  | x`mod`4==2 = x `xor` 1
  | x`mod`4==3 = 0

main = do
  [a,b] <- map read . words <$> getLine :: IO [Int]
  print $ f0 (a-1) `xor` f0 b
