#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long b[n / 2];
  for (long long i = 0; i < n / 2; ++i) {
    cin >> b[i];
  }
  stack<long long> s;
  vector<long long> v;
  v.push_back(0);
  s.push(b[0]);
  for (auto i = 1; i < n / 2; ++i) {
    if (b[i] - v[i - 1] <= s.top()) {
      v.push_back(v[i - 1]);
      s.push(b[i] - v[i - 1]);
    } else {
      s.push(s.top());
      v.push_back(b[i] - s.top());
    }
  }
  for (auto i = 0; i < n / 2; ++i) {
    cout << v[i] << " ";
  }
  while (!s.empty()) {
    cout << s.top() << " ";
    s.pop();
  }
  return 0;
}
