
main :: IO ()
main = do
  [a,b,k] <- map read . words <$> getLine
  putStrLn $ unwords $ map show $ solve a b k

solve :: Int -> Int -> Int -> [Int]
solve a b k = go a b k True
  where
    go x y 0 _ = [x,y]
    go x y n b | b && odd x = let x' = (x-1) `div` 2 in go x' (y+x') (n-1) (not b)
               | b && even x = let x' = x `div` 2 in go x' (y+x') (n-1) (not b)
               | odd y = let y' = (y-1) `div` 2 in go (x+y') y' (n-1) (not b)
               | otherwise = let y' = y `div` 2 in go (x+y') y' (n-1) (not b)
