#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n / 2);
  vector<long long> ans;
  vector<long long> ans1;
  for (int i = 0; i < n / 2; i++) {
    cin >> a[i];
  }
  long long last = 0;
  ans.push_back(0), ans1.push_back(2 * 1e18);
  for (int i = 0; i < n / 2; i++) {
    ans1.push_back(a[i]);
    ans.push_back(0);
    if (ans1[ans1.size() - 1] > ans1[ans1.size() - 2] ||
        ans[ans.size() - 1] < ans[ans.size() - 2]) {
      long long temp = max(ans1[ans1.size() - 1] - ans1[ans1.size() - 2],
                           ans[ans.size() - 2] - ans[ans.size() - 1]);
      ans1[ans1.size() - 1] = ans1[ans1.size() - 1] - temp;
      ans[ans.size() - 1] = temp;
      last = max(last, temp);
    }
  }
  for (int i = 1; i < ans.size(); i++) cout << ans[i] << ' ';
  reverse(ans1.begin(), ans1.end());
  for (int i = 0; i < ans1.size() - 1; i++) cout << ans1[i] << ' ';
  return 0;
}
