program exchange
  implicit none
  integer :: a, b, k, i
  read(*,*) a, b, k
  do i = 1, k
    a = (a-mod(a,2))/2
    b = b+a
    call swap(a,b)
  end do
  if (mod(k,2) == 1) call swap(a,b)
  write(*,'(i0,x,i0)') a, b
contains
  subroutine swap(a,b)
    integer, intent(inout) :: a, b
    a = xor(a,b)
    b = xor(a,b)
    a = xor(a,b)
  end
end program exchange