program rain_flows_into_dams
  implicit none
  integer :: n, i
  integer(8) :: a(100000), x(100000), s, t
  a = 0_8
  x = 0_8
  read(*,*) n
  read(*,*) a(1:n)
  s = sum(a(1:n))/2_8
  t = sum(a(1:n:2))
  x(1) = t-s
  do i = 2, n
    x(i) = a(i-1)-x(i-1)
  end do
  x(n) = a(n)-x(1)
  x(1:n) = 2_8*x(1:n)
  write(*,'(i0)',advance='no') x(1)
  do i = 2, n
    write(*,'(x,i0)',advance='no') x(i)
  end do
  write(*,*)
  stop
end program rain_flows_into_dams