#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
long long MOD = (long long)1e9 + 7;

long long quickpow(long long b, int e)
{
	return e ? ((e & 1 ? b : 1)*quickpow((b*b) % MOD, e >> 1)) % MOD : 1;
}

int p, a[3000], fac[3000], inv[3000], b[3000], cnt, dat[3000][3000];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> p;
	MOD = p;
	for (int i = 0; i < p; i++) {
		cin >> a[i];
		if (a[i] == 1) cnt++;
	}
	fac[0] = 1;
	for (int i = 1; i < p; i++) {
		fac[i] = i * fac[i - 1];
		fac[i] %= p;
	}
	for (int i = 0; i < p; i++) {
		inv[i] = quickpow(fac[i], p - 2);
		dat[i][0] = 1;
		for (int j = 1; j < p; j++) {
			dat[i][j] = dat[i][j - 1]*i;
			dat[i][j] %= p;
		}
	}
	for (int i = 0; i < p; i++) {
		int tmp = 0;
		for (int j = 0; j < p; j++) {
			if (a[j] == 0) continue;
			b[i] = fac[p - 1];
			b[i] *= inv[i];
			b[i] %= p;
			b[i] *= inv[p - 1 - i];
			b[i] %= p;
			b[i] *= dat[(p - j)%p][p - 1 - i];
			b[i] %= p;
			b[i] = p - b[i];
			b[i] %= p;
			tmp += b[i];
			tmp %= p;
		}
		b[i] = tmp;
	}
	b[0] += cnt;
	b[0] %= p;
	for (int i = 0; i < p; i++) {
		cout << b[i] << " ";
	}
	//system("pause");
	return 0;
}