program abc133d
   implicit none

   integer :: N, r1, i
   integer, allocatable :: a(:), r(:)

   read(*,*) N
   allocate( a(0:N), r(n))
   read(*,*) a(1:N)

   a(0) = a(N)
   r = 0
   r1 = 0
   do i = 1, n-2, 2
      r1 = r1 + a(i) - a(i+1)
   enddo
   r1 = r1 + a(n)

   r(1) = r1

   do i = n, 2, -1
      if (i == n) then
         r(n) = 2*a(n) - r(1)
         cycle
      else
         r(i) = 2*a(i) - r(i+1)
      end if
   enddo

   print *, r(:)
end program abc133d
