import           Data.Maybe
import           Data.Bits
import qualified Data.ByteString.Char8         as C8

getInts :: IO [Int]
getInts = fmap (map (fst . fromJust . C8.readInt) . C8.words) C8.getLine

main :: IO ()
main = do
    [a, b] <- getInts
    print $ (f a) `xor` (f b) `xor` a

f :: Int -> Int
f n = [n, 1, n + 1, 0] !! (n `mod` 4)
