#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int P, a, res[3000], b[3001], c[3001], d[3001];

int pw(int x, int y) {
	int a = 1;
	while (y) {
		if (y & 1) {
			a = a * x % P;
		}
		x = x * x % P;
		y >>= 1;
	}
	return a;
}

int modinv(int x) {
	return pw(x, P - 2);
}

int main() {
	cin >> P;
	b[0] = 1;
	for (int j = 0; j < P; ++j) {
		for (int k = P; k >= 0; --k) {
			b[k + 1] = (b[k + 1] + b[k]) % P;
			b[k] = b[k] * (P - j) % P;
		}
	}
	for (int i = 0; i < P; ++i) {
		cin >> a;
		if (a) {
			for (int j = P; j >= 0; --j) {
				c[j] = b[j];
			}
			for (int j = P - 1; j >= 0; --j) {
				d[j] = c[j + 1];
				c[j] += d[j] * i;
				c[j] %= P;
			}
			int t = 1;
			for (int j = 0; j < P; ++j) {
				if (i == j)continue;
				t *= (P + i - j);
				t %= P;
			}
			t = modinv(t);
			for (int j = 0; j < P; ++j) {
				res[j] += d[j] * t;
				res[j] %= P;
			}
		}
	}
	for (int j = 0; j < P; ++j) {
		cout << res[j];
		if (j != P - 1)cout << sp;
	}
	cout << endl;
}