# frozen_string_literal: true
require 'matrix'

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

ma = Array.new(n).map { Array.new(n, 0) }

v = Vector.elements(a)

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

m = Matrix.rows(ma)

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