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



for k in range(K):

    if k%2 == 0:

        if A%2 == 0:

            A //= 2

            B += A

        else:

            A -= 1

            A //= 2

            B += A

    else:

        if B%2 == 0:

            B //= 2

            A += B

        else:

            B -= 1

            B //= 2

            A += B

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

for k in range(K):

    if k%2 == 0:

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

    else:

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

print((A,B))

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

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

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