#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long lol[n / 2];
  for (long long i = 0; i < n / 2; i++) cin >> lol[i];
  vector<long long> l, r;
  l.push_back(0);
  r.push_back(lol[0]);
  for (long long i = 1; i < n / 2; i++) {
    long long a = 0;
    if (lol[i] > r[i - 1]) {
      long long x = lol[i] - r[i - 1];
      lol[i] -= x;
      a += x;
    }
    if (a < l[i - 1]) {
      long long x = l[i - 1] - a;
      lol[i] -= x;
      a += x;
    }
    l.push_back(a);
    r.push_back(lol[i]);
  }
  for (long long i : l) cout << i << " ";
  reverse(r.begin(), r.end());
  for (long long i : r) cout << i << " ";
  cout << endl;
}
