program asakatsu318A
    implicit none
    integer(8)::A,B,K,i
    read*,A,B,K
    do i=1,K
        if(mod(i,2)==1)then
            if(mod(A,2)==1)A=A-1
            B=B+A/2
            A=A/2
        else if(mod(i,2)==0)then
            if(mod(B,2)==1)B=B-1
            A=A+B/2
            B=B/2
        end if
    end do
    print'(i0,1x,i0)',A,B
end program asakatsu318A