#include <bits/stdc++.h>
using namespace std;
const int N=3000;
int d[N], a[N], c[N], r[N], ans[N];
int p;

void prod() {
	d[1]=1;
	//  f(x)=sum di*x^i
	//  ff(x) = sum  di*x^(i+1) - d(i+1) 
	for (int i=1; i<p; i++) {
		for (int j=i+1; j>=1; j--) d[j]=(d[j-1]-i*d[j]%p+p)%p;
	//	for (int j=i+1; j>=1; j--) cout<<d[j]<<"x^"<<j<<"+";cout<<endl; 
	}
	for (int i=1; i<p; i++) d[i]=(d[i]%p+p)%p;
//	for (int i=p; i>=1; i--) cout<<d[i]<<"x^"<<i<<"+";
	//cout<<endl;
}

void div(int k) {
	//D / (x-k)
	for (int i=0; i<=p; i++) c[i]=d[i];
	for (int i=p; i>=1; i--) {
		c[i-1]=(c[i-1]+c[i]*k)%p;
	}
	for (int i=0; i<p; i++) ans[i]=(ans[i]+a[k]*c[i+1])%p;
//	if (c[0]!=0) cout<<"gg: "<<k<<endl;
//	for (int j=p; j>=0; j--) cout<<c[j]<<" ";cout<<endl;//<<"x^"<<j<<"+";cout<<endl; 
}
	
int main() {
	cin>>p;
	prod();
	//b[0]=a[0];
	//f(1)*1
	for (int i=0; i<p; i++) cin>>a[i];
	
	for (int i=1; i<p; i++)
	for (int j=1; j<p; j++) {
		if (i*j%p==1) r[i]=j;
	}
	
	for (int i=0; i<p; i++)
	for (int j=0; j<p; j++) {
		if (i!=j) a[i]=a[i]*r[(i-j+p)%p]%p;
	}
	
	
	for (int i=0; i<p; i++) div(i);
	for (int i=0; i<p; i++) cout<<ans[i]%p<<" ";

	return 0;
}