#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>

using namespace std;

const int MAX = 1000;

int A[ MAX ];
int B[ MAX ], C[ MAX ];
int N;
//1111111
int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	cin >> N;
	for (int i = 1; i <= N; i++)
		cin >> A[ i ];

	int len = 1;
	for (int i = 1; len < N; i++)
	{
		//for (int j = 1; j <= N; j++)
		//	B[ j ] = A[ j ];

		int c1 = 0;
		int c2 = 0;
		for (int j = 1; j <= len; j++)
		{
			int x = (A[ j ] + A[ j + len ]) / 2;//(A[ j * 2 - 1 ] + A[ j * 2 ]) / 2;
			int y = x - A[ j + len ];
			B[ c1++ ] = x;
			C[ c2++ ] = y;

			//cout << x << ' ' << y << endl;
		}

		for (int j = 0; j < 2 * c1; j += 2)
		{
			int k = j + 1;
			A[ k ] = B[ j / 2 ];
			A[ k + 1 ] = C[ j / 2 ];
		}
		//for (int j = 0; j < c1; j++)
		//	A[ j + 1 ] = B[ j ];
		//for (int j = 0; j < c2; j++)
		//	A[ j + 1 + c1 ] = C[ j ];
		len *= 2;

		//cout << len << endl;
		//for (int i = 1; i <= N; i++)
		//	cout << A[ i ] << ' ';
		//cout << endl;

	}

	for (int i = 1; i <= N; i++)
		cout << A[ i ] << ' ';

	fclose(stdin);
    fclose(stdout);
	return 0;
/*
8 39 -15 2 -3 3 1 -2 3

8 5 2 3 2 5 7 9 6
*/
}