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

int modpow(int a,int n,int p){
    int res=1;
    while(n>0){
        if (n&1) res=res*a%p;
        a=a*a%p; n>>=1;
    }
    return res;
}

int modinv(int a,int p){
    return modpow(a,p-2,p);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int p; cin >> p;
    vector<int> a(p);
    for (int i=0;i<p;++i) cin >> a[i];
    for (int i=0;i<p;++i){
        int t=1;
        for (int j=0;j<p;++j) if (i!=j) (t*=(i-j+p)%p)%=p;
        a[i]*=modinv(t,p);
    }
    vector<vector<int>> dp(2,vector<int>(p+1,0));
    dp[0][0]=1;
    int cur=0,nxt=1;
    for (int i=0;i<p;++i){
        for (int j=0;j<p+1;++j){
            (dp[nxt][j]=p-dp[cur][j]*i%p)%=p;
            if (j) (dp[nxt][j]+=dp[cur][j-1])%=p;
        }
        swap(nxt,cur);
    }
    vector<int> inv(p),res(p,0);
    for (int i=0;i<p;++i) inv[i]=modinv(i,p);
    for (int i=0;i<p;++i){
        if (a[i]==0) continue;
        if (!i) for (int j=0;j<p;++j){
            (res[j]+=dp[cur][j+1]*a[i]%p)%=p;
        } else {
            (res[0]+=p-dp[cur][0]*inv[i]%p*a[i]%p)%=p;
            int pre=(p-dp[cur][0]*inv[i]%p)%p;
            for (int j=1;j<p;++j){
                (res[j]+=p-(dp[cur][j]-pre+p)%p*inv[i]%p*a[i]%p)%=p;
                pre=(p-(dp[cur][j]-pre+p)%p*inv[i]%p)%p;
            }
        }
    }
    for (int i=0;i<p;++i) cout << res[i] << (i!=p-1?' ':'\n');
}