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