#include <bits/stdc++.h>
using namespace std;
void cases() {
  long long n, i, mn, mx;
  cin >> n;
  long long b[n / 2], a[n];
  for (auto& i : b) cin >> i;
  mx = b[0], mn = 0;
  a[0] = 0, a[n - 1] = b[0];
  for (i = 1; i < n / 2; i++) {
    if (b[i] >= mx) {
      if (b[i] - mx < mn) {
        a[i] = mn;
        a[n - i - 1] = b[i] - mn;
        mx = a[n - i - 1];
      } else {
        a[n - i - 1] = mx;
        a[i] = b[i] - mx;
        mn = max(mn, a[i]);
      }
    } else {
      a[i] = mn;
      a[n - i - 1] = b[i] - mn;
      mx = min(mx, a[n - i - 1]);
    }
  }
  for (auto i : a) cout << i << ' ';
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cases();
  return 0;
}
