#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)
 
struct Problem {
 
	void Solve() {
		UL P; cin >> P;
		vector<UL> A(P); rep(i, P) cin >> A[i];
		if (P == 2) { cout << A[0] << " " << (A[0] ^ A[1]) << endl; return; }
		UL R;
		for (UL r = 2; r < P; r++) {
			UL tmp = 1;
			rep(i, P - 1) {
				tmp *= r; tmp %= P;
				if (tmp == 1) { tmp = i + 1; break; }
			}
			if (tmp == P - 1) { R = r; break; }
		}
		vector<UL> Q(P); Q[0] = 1;
		rep(i, P - 1) Q[i + 1] = Q[i] * R % P;
		vector<UL> F(P);
		rep(i, P - 1) F[Q[i]] = i;
		reverse(Q.begin(), Q.end());
 
		vector<UL> B(P); B[0] = A[0];
		for (UL i = 1; i < P; i++) A[i] = (A[i] + P - A[0]) % P;
 
		for (UL i = 1; i < P; i++) {
			for (UL j = 1; j < P; j++) {
				B[i] += A[j] * Q[F[j] * i % (P - 1)];
				B[i] %= P;
			}
			B[i] = B[i] * (P - 1) % P;
		}
		rep(i, P) { if (i) cout << " "; cout << B[i]; }
		cout << endl;
 
		/*
		rep(i, P) {
			vector<UL> X(P); X[0] = 1;
			rep(j, P - 1) X[j + 1] = X[j] * i % P;
			UL ans = 0;
			rep(j, P) ans += B[j] * X[j] % P;
			ans %= P;
			cout << ans << " ";
		} cout << endl;
		*/
	}
 
	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}