n = gets.to_i

a = gets.split.map(&:to_i)

res = 0

rem = a[0] # - res

(n - 1).times do |i|
  rem = a[i + 1] - rem
  if (rem < 0)
    if i % 2 == 0
      res += -rem
      rem = 0
    else
      res -= -rem
      rem = 0
    end
  end
end

if rem != res
  res = (res + rem) / 2
end

output = [res * 2]

rem = a[0] - res

(n - 1).times do |i|
  output.push (rem * 2)
  rem = a[i + 1] - rem
end

puts output.join(" ")