#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long b[(long long)(n / 2 + 4)];
  long long i, j, a[n + 2];
  for (i = 1; i <= n / 2; ++i) cin >> b[i];
  i = n / 2;
  j = i + 1;
  a[i] = b[i] / 2;
  a[j] = b[i] - a[i];
  i--;
  j++;
  while (i >= 1 && j <= n) {
    a[j] = a[j - 1];
    a[i] = b[i] - a[j];
    if (a[i] > a[i + 1]) {
      a[j] += a[i] - a[i + 1];
      a[i] = b[i] - a[j];
    }
    --i;
    ++j;
  }
  for (i = 1; i <= n; ++i) cout << a[i] << " ";
  return 0;
}
