A, B, K = list(map(int, input().split()))



for i in range(K):

    if A % 2 == 1:

        A -= 1

    A /= 2

    A, B = B + A, A



if K % 2 == 1:

    A, B = B, A

print((int(A), int(B)))
A, B, K = list(map(int, input().split()))



for i in range(K):

    if i % 2 == 0:

        A, B = A // 2, B + A // 2

    else:

        A, B = A + B // 2, B // 2



print((int(A), int(B)))
A, B, K = list(map(int, input().split()))
for i in range(K):
    if A % 2 == 1:
        A -= 1
    A /= 2
    A, B = B + A, A
if K % 2 == 1:
    A, B = B, A
print((int(A), int(B)))

A, B, K = list(map(int, input().split()))
for i in range(K):
    if i % 2 == 0:
        A, B = A // 2, B + A // 2
    else:
        A, B = A + B // 2, B // 2
print((int(A), int(B)))

-    if A % 2 == 1: -        A -= 1 -    A /= 2 -    A, B = B + A, A -if K % 2 == 1: -    A, B = B, A +    if i % 2 == 0: +        A, B = A // 2, B + A // 2 +    else: +        A, B = A + B // 2, B // 2