program main
implicit none
integer :: i, j, c
integer :: a, b, k

read(*,*) a, b, k

j = k/2
do i = 1, j
   if( mod(a,2) == 1 ) then
      a = a-1
    end if
    c = a/2
    a = a-c
    b = b+c
    if( mod(b,2) == 1 ) then
       b = b-1
    end if
    c = b/2
    a = a+c
    b = b-c
end do
if( mod(k,2) == 1 ) then
   if( mod(a,2) == 1 ) then
      a = a-1
    end if
    c = a/2
    a = a-c
    b = b+c
end if
write(*,'(i0,a1,i0)') a,' ',b
end program main
