let rec solve a b = function
  | 0 -> (a, b)
  | k -> solve (b + a / 2) (a / 2) (k - 1)

let () = Scanf.scanf "%d %d %d" @@ fun a b k ->
  let (a, b) = solve a b k in
  if k mod 2 = 0
  then Printf.printf "%d %d\n" a b
  else Printf.printf "%d %d\n" b a

