require 'matrix'

n = gets.to_i
arr = gets.split(' ').map(&:to_i)
vec = Matrix[
  [0.5, 0.5, 0.0],
  [0.5, 0.0, 0.5],
  [0.0, 0.5, 0.5]
].lup.solve([arr[0], arr[1], arr[2]])
results = []
results.push(vec[1].to_i)
results.push(vec[0].to_i)
results.push(vec[2].to_i)

3.upto(n - 1) do |i|
  num1 = arr[i - 1]
  result = results[i - 1]
  results.push((num1 - (result / 2)) * 2)
end

puts results.join(' ')