#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long int n;
  vector<long long int> a;
  deque<long long int> dq1, dq2;
  cin >> n;
  for (long long int i = 0, temp; i < n / 2; i++) {
    cin >> temp;
    a.emplace_back(temp);
  }
  long long int r = (n / 2) - 1;
  dq1.push_back(0), dq2.push_back(a[0]);
  for (long long int i = 1; i <= r; i++) {
    dq2.push_front(min(a[i] - dq1.back(), dq2.front()));
    dq1.push_back(max(dq1.back(), a[i] - dq2.front()));
  }
  for (auto i : dq1) cout << i << " ";
  for (auto i : dq2) cout << i << " ";
  cout << endl;
  return 0;
}
