import Data.Bits main :: IO () main = do [f0, f1, n] <- map read . words <$> getLine :: IO [Int] let f2 = f0 `xor` f1 print $ [f0, f1, f2] !! (n `mod` 3)