#include <bits/stdc++.h>
using namespace std;

#define TASK "sequence"

typedef long long ll;

const ll INF = (ll) 1e9;

int n;
vector <int> a;

bool ok(int x, int y, vector <ll> &b)
{
	b[0] = x;
	b[1] = y;
	ll max = -INF;
	ll min = INF;
	for (int i = 2; i < n + 2; i++) {
		b[i] = a[i - 2] - b[i - 2] - b[i - 1];
		max = ::max(max, b[i]);
		min = ::min(min, b[i]);
	}

	return min >= -INF && max <= INF;
}

int rand(int a, int b) {
	unsigned aa = rand() & 0xFFFF;
	unsigned bb = rand() & 0xFFFF;
	unsigned c = aa | (bb << 16);

	c %= (b - a + 1);
	return a + c;
}

void solve()
{
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	int l = -INF;
	int r = INF;

	vector <ll> best(n + 2);
	vector <ll> b(n + 2);

	for (int i = 0; i < 23; i++) {
		int x = rand(-INF / 3, INF / 3);
		int y = rand(-INF / 3, INF / 3);
		if (ok(x, y, best)) goto OUTPUT;
	}

	while (r - l > 10) {
		int m1 = l + (r - l) / 3;
		int m2 = r - (r - l) / 3;
		bool fm1 = ok(m1, m1, b);
		bool fm2 = ok(m2, m2, b);
		if (!fm1) l = m1;
		if (!fm2) r = m2;
		if (fm1 && fm2) {
			l = m1;
			r = m2;
			break;
		}
	}

	for (int i = l; i <= r; i++) {
		if (ok(i, i, b)) {
			best = b;
			break;
		}
	}

OUTPUT:
	for (int i = 0; i < (int)best.size(); i++) cout << best[i] << " "; cout << endl;
}

int main()
{
	freopen(TASK ".in", "r", stdin);
	freopen(TASK ".out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}
