program prob1
    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)then
                a = a - 1
            end if
            b = b + a / 2
            a = a / 2
        else
            if(mod(b, 2) == 1)then
                b = b - 1
            end if
            a = a + b / 2
            b = b / 2
        end if
    end do
    write(*,*) a, b

    stop
contains
end program prob1