import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

alias sread = () => readln.chomp();

void main()
{
    auto abk = aryread();

    foreach (i; 0 .. abk[2])
    {
        abk[(i + 1) % 2] += abk[i % 2] / 2;
        abk[i % 2] /= 2;
    }
    writefln("%d %d", abk[0], abk[1]);
}
