import Data.Bits main :: IO () main = interact $ show . solve . map read . words solve :: [Int] -> Int solve [a, b, c] = [a, b, a `xor` b] !! (c `mod` 3)