#include <bits/stdc++.h>
using namespace std;

int powm( int x, int n, int mod )
{
	int res = 1;
	while( n ) {
		if( n % 2 ) {
			res *= x;
			res %= mod;
		}
		x *= x;
		x %= mod;
		n /= 2;
	}
	return res;
}

int main()
{
	int p;
	cin >> p;
	vector<int> a( p );
	for( int i = 0; i < p; i++ ) {
		cin >> a[i];
	}

	vector<long long> poly( p + 1 );
	poly[0] = 1;
	for( int i = 0; i < p; i++ ) {
		vector<long long> tmp( p + 1 );
		for( int j = 0; j < p; j++ ) tmp[j + 1] = poly[j];
		for( int j = 0; j < p; j++ ) tmp[j] = (tmp[j] - (poly[j] * i % p) + p) % p;
		swap( poly, tmp );
	}

	vector<long long> ans( p );
	for( int i = 0; i < p; i++ ) {
		if( a[i] == 0 ) continue;
		long long q = 1;
		for( int j = 0; j < p; j++ ) {
			if( i == j ) continue;
			q = q * (i - j) % p;
		}
		q = powm( (q % p + p) % p, p - 2, p );
		vector<long long> tmp = poly;
		for( int j = p; j > 0; j-- ) {
			ans[j - 1] += tmp[j] * q;
			ans[j - 1] %= p;
			tmp[j - 1] = (tmp[j - 1] + tmp[j] * i) % p;
		}
	}


	for( int i = 0; i < p; i++ ) {
		if( i ) cout << " ";
		cout << ans[i] % p;
	}
	cout << endl;
}
