a,b,k=list(map(int,input().split()))

for i in range(k):

    if i%2==0:

        a = a//2

        b += a

    else:

        b = b//2

        a += b

print((a,b))
a,b,k=list(map(int,input().split()))

for i in range(k):

    if i%2>0:b//=2;a+=b

    else:a//=2;b+=a

print((a,b))
a, b, k = list(map(int, input().split()))
for i in range(k):
    if i % 2 == 0:
        a = a // 2
        b += a
    else:
        b = b // 2
        a += b
print((a, b))

a, b, k = list(map(int, input().split()))
for i in range(k):
    if i % 2 > 0:
        b //= 2
        a += b
    else:
        a //= 2
        b += a
print((a, b))

-    if i % 2 == 0: -        a = a // 2 +    if i % 2 > 0: +        b //= 2 +        a += b +    else: +        a //= 2 -    else: -        b = b // 2 -        a += b