#include <bits/stdc++.h>
using namespace std;
int readint() {
  int x;
  scanf("%d", &x);
  return x;
}
long long readll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int n;
long long b[200005], a[200005];
int main() {
  n = readint();
  int ndiv2 = n / 2;
  for (int i = 1; i <= ndiv2; i++) b[i] = readll();
  a[1] = 0;
  a[n] = b[1];
  for (int i = 2; i <= ndiv2; i++) {
    pair<long long, long long> p1 = make_pair(a[i - 1], b[i] - a[i - 1]);
    pair<long long, long long> p2 =
        make_pair(b[i] - a[n - i + 2], a[n - i + 2]);
    bool flag = false;
    if (p1.second <= a[n - i + 2]) {
      a[i] = p1.first;
      a[n - i + 1] = p1.second;
      flag = true;
    }
    if (p2.first >= a[i - 1]) {
      if (!flag || a[i] > p2.first) {
        a[i] = p2.first;
        a[n - i + 1] = p2.second;
      }
    }
  }
  printf("%lld", a[1]);
  for (int i = 2; i <= n; i++) printf(" %lld", a[i]);
  puts("");
  return 0;
}
