#include <bits/stdc++.h>
using namespace std;
void solve() {
  string second;
  long long n, i, m, ans = 0, j, k, sum = 0;
  cin >> m;
  n = m;
  vector<long long> b(m / 2), a(n);
  for (i = 0; i < n / 2; i++) cin >> b[i];
  a[0] = 0;
  a[n - 1] = b[0];
  for (i = 1; i < m / 2; i++) {
    long long diff = 0;
    if (b[i] > a[n - i]) diff = b[i] - a[n - i];
    if (diff < a[i - 1]) diff = a[i - 1];
    a[i] = diff;
    a[n - i - 1] = b[i] - diff;
  }
  for (i = 0; i < a.size(); i++) cout << a[i] << " ";
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  solve();
}
