#include <iostream>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <cstring>
 
 
using namespace std;
 
#define ll long long
 
const int maxn = 3e6;
const int inf = 1000000007;
const int mod = 1000000007;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const int MX = 1e9; 

int n;
long long a[maxn], b[maxn];
 
int main() {
	freopen("sequence.in", "r", stdin);
	freopen("sequence.out", "w", stdout);

	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];

	for (int i = 2; i <= n + 1; i++) {
	 	// b[i - 2] + b[i - 1] + b[i] == a[i - 1]
		// b[i] = a[i - 1] - b[i - 2] - b[i - 1]
		b[i] = a[i - 1] - b[i - 2] - b[i - 1];
		// b[i - 1] + b[i - 2] = a[i - 2] - b[i - 3]
		// b[i] = a[i - 1] - a[i - 2] + b[i - 3]
		// consider b[0] = b[1] = 0, we achieve that b[n] will be not more than n * 2 / 3 * a_max
	}
	// b[2] = a[1] - b[0] - b[1]           
	for (int i = 0; i <= n + 1; i++) {
		cout  << b[i] << " \n"[i == n + 1];
	}

    return 0;
}                                                                           