program exchange
  implicit none
  integer :: a, b, k, i
  read(*,*) a, b, k
  do i = 1, k
     if (mod(i,2) .eq. 1) then
        a = a/2
        b = b+a
     else
        b = b/2
        a = a+b
     end if
  end do
  write(*,'(i0,x,i0)') a, b
  stop
end program exchange