open Printf
open Scanf

let id x = x
let pair x y = x, y

let a, b, k = scanf "%d %d %d" (fun a b k -> a, b, k)

let op a b =
  (if !a mod 2 <> 0 then a := !a - 1);
  let ha = !a / 2 in
  a := !a - ha;
  b := !b + ha

let () =
  let ra = ref a in
  let rb = ref b in
  let a = ref ra in
  let b = ref rb in
  for i = 1 to k do
    op !a !b;
    let t = !a in
    a := !b;
    b := t
  done;
  printf "%d %d\n" !ra !rb
