#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int b[n / 2];
  long long int flag = 0;
  long long int maxi = 0;
  for (int i = 0; i < n / 2; i++) {
    cin >> b[i];
  }
  vector<long long int> v1, v2;
  long long int k = 0;
  for (int i = 0; i < n / 2; i++) {
    if (i == 0) {
      v1.push_back(0);
      v2.push_back(b[i]);
    } else {
      if (b[i] >= b[i - 1]) {
        v1.push_back(b[i] - v2[i - 1]);
        v2.push_back(v2[i - 1]);
      } else if (b[i] < b[i - 1]) {
        v1.push_back(v1[i - 1]);
        v2.push_back(b[i] - v1[i - 1]);
      }
    }
  }
  for (int i = 0; i < v1.size(); i++) {
    cout << v1[i] << " ";
  }
  for (int i = v2.size() - 1; i >= 0; i--) {
    cout << v2[i] << " ";
  }
  cout << endl;
  return 0;
}
