program main
integer(8) :: n,i,s
integer, allocatable :: x(:),a(:)
read(*,*)n
allocate(a(n),x(n))
read(*,*)(a(i),i=1,n)
s = sum(a)
do i = 2,n-1,2
s = s - 2*a(i)
end do
x(1) = s

do i = 2,n
x(i) = 2*a(i-1) - x(i-1)
end do
write(*,*)x
end program main