#include <stdio.h>
#include <ctype.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

/*
bool used[1002];
int dist[1002];
int n, m, count2;
double d1, d2;
int x[1002], y[1002];

double D(int a, int b)
{
	return sqrt( (double)(x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]) );
}*/

int A[257];
int count2;

void R(int a)
{
	if( a > count2 )
	{
		return;
	}
	int B[257];
	for(int i = 0; i < a; i++)
	{
		B[i] = A[i];
	}
	for(int i = 0; i < a/2; i++)
	{
		A[i * 2] = (B[i] + B[i + a/2])/2;
		A[i * 2 + 1] = A[i * 2] - B[i + a/2];
	}
	R(a*2);
}

int main()
{
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);

	scanf("%d", &count2);
	for(int i = 0; i < count2; i++)
	{
		scanf("%d", &A[i]);
	}

	R(2);

	for(int i = 0; i < count2; i++)
	{
		printf("%d ", A[i]);
	}

	/*scanf("%d%d%d%lf%lf", &count2, &n, &m, &d1, &d2);

	for(int i = 1; i <= count2; i++)
	{
		scanf("%d%d", &x[i], &y[i]);
	}

	for(int i = 1; i <= count2; i++)
	{
		if( i != n )
		{
			dist[i] = 100500;
		}
	}

	while(1)
	{
		int index;
		bool found = false;
		int min;
		for(int i = 1; i <= count2; i++)
		{
			if( !used[i] && (!found || min > dist[i] ) )
			{
				found = true;
				min = dist[i];
				index = i;
			}
		}

		if( !found )
		{
			break;
		}

		used[index] = true;

		for(int i = 1; i <= count2; i++)
		{
			if( D(i, index) <= d1 + d2 + 1E-9 && !used[i] && dist[index] + 1 < dist[i] )
			{
				dist[i] = dist[index] + 1;
			}
		}
	}
	if( dist[m] == 100500 )
	{
		printf("Impossible\n");
	}
	else
	{
		printf("%d\n", dist[m]);
	}*/
	return 0;
}