#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int qtn;
  cin >> qtn;
  vector<long long int> resp(qtn + 1);
  resp[qtn] = 1000000000000000010;
  for (int i = 0; i < qtn >> 1; i++) {
    long long int n;
    cin >> n;
    resp[qtn - i - 1] = min(resp[qtn - i], n);
    resp[i] = n - resp[qtn - i - 1];
    if (i) {
      if (resp[i] < resp[i - 1]) {
        resp[i] = resp[i - 1];
        resp[qtn - i - 1] = n - resp[i];
      }
    }
  }
  for (int i = 0; i < qtn; i++) {
    cout << resp[i] << " ";
  }
  return 0;
}
