# frozen_string_literal: true
require 'matrix'

n = gets.to_i
a = gets.split.map { |e| e.to_i * 2 }

m = Matrix.build(n, n) { 0 }
v = Vector.elements(a)

0.upto(n - 2) do |i|
  m[i, i] = 1
  m[i, i + 1] = 1
end
m[n - 1, n - 1] = 1
m[n - 1, 0] = 1

puts (m.inv * v).to_a.map(&:to_i).join(' ')
