#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int main() {
  int n;
  cin >> n;
  long long arr[N] = {0};
  long long b[N / 2] = {0};
  for (int i = 0; i < n / 2; i++) {
    cin >> b[i];
  }
  for (long long i = 0, t = n - 1, x = 0, y = b[i]; i < t;
       i++, t--, y = arr[t + 1], x = arr[i - 1]) {
    while (x + y != b[i]) {
      if (x + y < b[i]) {
        x = b[i] - y;
      } else {
        y = b[i] - x;
      }
    }
    arr[i] = x;
    arr[t] = y;
  }
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << endl;
  return 0;
}
