#include <iostream>
#include <fstream>
#include <string.h>
#include <math.h>

using namespace std;

int main()
{
	ifstream input("input.txt", ios::in);
	ofstream output("output.txt", ios::out);
	
	int N;
	input >> N;

	long *arr = new long[N];
	long *arr2 = new long[N];
	for (int i = 0; i < N; i++)
	{
		input >> arr[i];
		//cout << i << ": " << arr[i] << endl;
	}

	long a;
	long b;
	
	//cout << "N = " << N << endl;
	long test = N;
	long max = 0;
	while(test != 1)
	{
		max++;
		test /= 2;
	}
	//int max = sqrt((float)N);
	//cout << "max: " << max << endl;
	for (int i = 0; i < max; i++)
	{
		for (int k = 0; k < N; k++)
			arr2[k] = arr[k];
		for (int j = 0; j < 2*i + (i == 0 ? 1 : 0); j++)
		{
			//cout << "---- " << i << " ----" << endl;
			//cout << "plus: " << j << endl;
			//cout << "minus: " << 2*i + j + (i == 0 ? 1 : 0) << endl;
			//cout << "1: " << 2*j << endl;
			//cout << "2: " << 2*j + 1 << endl;
			//cout << "test: " << arr[j] << " | " << arr[2*i + j + (i == 0 ? 1 : 0)] << endl;
			b = (arr[j] - arr[2*i + j + (i == 0 ? 1 : 0)]) / 2;
			a = arr[j] - b;
			arr2[2*j] = a;
			arr2[2*j + 1] = b;
			
			//cout << "a: " << a << endl;
			//cout << "b: " << b << endl;

			//for (int z = 0; z < N; z++)
			//	cout << arr2[z] << " ";
			//cout << endl;
		}
		for (int k = 0; k < N; k++)
			arr[k] = arr2[k];
	}
	for (int i = 0; i < N; i++)
	{
		if (i != 0)
			output << " ";
		output << arr[i];
	}
	output << endl;
	//output << mas[int1 + int2];
	
	//cin.get();
	return 0;
}