import Control.Monad
import Data.Bits

main = do
    [a, b] <- map read <$> words <$> getLine
    putStrLn $ show $ solve (a - 1) `xor` solve b

solve :: Integer -> Integer
solve a | a `mod` 4 == 0 = a
        | a `mod` 4 == 1 = 1
        | a `mod` 4 == 2 = a + 1
        | otherwise      = 0