a,b,k = (int(i) for i in input().split())

for i in range(k):

    if(i%2==0):

        if(a%2==1):

            a -=1

        b += a/2

        a /= 2

    else:

        if(b%2==1):

            b -= 1

        a += b/2

        b /= 2

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

for i in range(k):

    if i%2==0:

        if a%2==1:

            a -= 1

        b += a//2

        a = a//2

    else:

        if b%2 == 1:

            b -= 1

        a += b//2

        b = b//2

print((a,b))

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

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

-a, b, k = (int(i) for i in input().split()) +a, b, k = list(map(int, input().split())) -        b += a / 2 -        a /= 2 +        b += a // 2 +        a = a // 2 -        a += b / 2 -        b /= 2 -print((int(a), int(b))) +        a += b // 2 +        b = b // 2 +print((a, b))