#include <bits/stdc++.h>
using namespace std;
const int nn = 2e5 + 8;
long long a[nn], b[nn / 2];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long l = 0;
  long long r = 2e18;
  for (int i = 1; i <= n / 2; i++) {
    cin >> b[i];
    a[i] = l;
    a[n - i + 1] = b[i] - a[i];
    long long delta = max(0ll, a[n - i + 1] - r);
    a[i] += delta;
    a[n - i + 1] -= delta;
    l = a[i];
    r = a[n - i + 1];
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
}
