In the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi:    * If the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person.  Find the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.
# tenka1-2018-beginnerB - Exchange
def main():
    A, B, K = tuple(map(int, input().split()))
    for i in range(K):
        if i & 1:
            if A & 1:
                A -= 1
            A //= 2
            B += A
        else:
            if B & 1:
                B -= 1
            B //= 2
            A += B
    print(A, B)


if __name__ == "__main__":
    main()
# tenka1-2018-beginnerB - Exchange
def main():
    A, B, K = tuple(map(int, input().split()))
    for i in range(K):
        if i & 1 == 0:
            if A & 1:
                A -= 1
            A //= 2
            B += A
        else:
            if B & 1:
                B -= 1
            B //= 2
            A += B
    print(A, B)


if __name__ == "__main__":
    main()