program prob1
    implicit none
    integer::A, B, K, i
    read(*,*) A, B, K

    i = 0
    do while(i < K)
        if(mod(A,2) == 1) then
            A = A - 1
        end if
        B = B + A/2
        A = A/2
        i = i+1
        if(i == K) then
            exit
        end if
        if(mod(B,2) == 1) then
            B = B - 1
        end if
        A = A + B/2
        B = B/2
        i = i+1
    end do
    write(*,*) A, B
    stop
end program