let solve tak aoki k =
    let rec solve_t tak aoki k =
        if k = 0 then tak, aoki
        else solve_a (tak / 2) (aoki + tak / 2) (k - 1)
    and solve_a tak aoki k =
        if k = 0 then tak, aoki
        else solve_t (tak + aoki / 2) (aoki / 2) (k - 1)
    in solve_t tak aoki k

let () =
    let tak, aoki = Scanf.scanf "%d %d %d\n" solve in
    Printf.printf "%d %d\n" tak aoki
