#include <bits/stdc++.h>
using namespace std;
struct Edge;
struct Edge {
  long long int to, weight;
  Edge(long long int to, long long int w) : to(to), weight(w) {}
};
const long long int mod = 1000000007;
void func() {
  long long int n;
  cin >> n;
  vector<long long int> a(n, 0);
  for (long long int i = 0; i < n / 2; i++) cin >> a[n - 1 - i];
  for (long long int i = n - 2; i >= n / 2; i--) {
    a[n - i - 1] = max(a[n - i - 2], a[i] - a[i + 1]);
    a[i] -= a[n - i - 1];
  }
  for (long long int i = 0; i < n; i++) cout << a[i] << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1;
  for (long long int num = 1; num <= t; num++) {
    func();
  }
}
