program answer
  implicit none
  integer :: A, B, K, i, c, d
  read(*,*) A, B, K

  c=A
  d=B
  do i = 1, K
     if(mod(i,2)==1) then
     if(mod(c,2)==1) then
        c=c-1
        c=c/2
        d=d+c
     else
        c=c/2
        d=d+c
     end if

     else
  
     if(mod(d,2)==1) then
        d=d-1
        d=d/2
        c=c+d
     else
        d=d/2
        c=c+d
     end if
     end if
  end do

  write(*,*) c, d
  stop
 end program answer