Scanf.scanf "%d %d %d\n" (fun a b k ->
  let mv (a, b) =
    let a = if a mod 2 = 1 then a-1 else a in
    let b = b + (a/2) in
    let a = a - (a/2) in
    (a,b)
  in
  let rec loop i (a,b) =
    if i=k then (a,b) else
    if i mod 2 = 0 then loop (i+1) (mv (a,b)) else
    let (b,a) = mv (b,a) in loop (i+1) (a,b)
  in
  let (a,b) = loop 0 (a,b) in
  Printf.printf "%d %d\n" a b
)