#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n, i, a;
  int64_t x[200010];
  cin >> n;
  cin >> a;
  x[1] = 0;
  x[n] = a;
  for (i = 2; i <= n / 2; i++) {
    cin >> a;
    if (a > x[n - i + 2])
      x[n - i + 1] = x[n - i + 2];
    else
      x[n - i + 1] = a;
    x[i] = a - x[n - i + 1];
    if (x[i] < x[i - 1]) x[i] = x[i - 1];
    x[n - i + 1] = a - x[i];
  }
  for (i = 1; i <= n; i++) {
    cout << x[i] << " ";
  }
  return 0;
}
