#include <iostream>
#include <bits/stdc++.h>

using namespace std;
int c[3005],pt;
int p,a[3005],b[3005],inv[3005];

int getc(int d)
{
    if(d==0||d==p-1) return 1;
    if(c[d]!=-1) return c[d];
    return c[d] = 1LL*pt*inv[d]*inv[p-d-1]%p;
}

int main()
{
    scanf("%d",&p);

    memset(c,-1,sizeof(c));
    for(int i=0;i<p;++i) scanf("%d",a+i);
    pt = 1;
    for(int i=2;i<=p-1;++i){
        pt*=i;pt%=p;
    }
    int tmp = 1;
    for(int i=1;i<=p-1;++i){
        inv[i]=1;tmp*=i;tmp%=p;
        for(int j=0;j<p-2;++j)
            {inv[i]*=tmp;inv[i]%=p;}
    }

    for(int i=0;i<p;++i){
        if(a[i]==0) continue;
        ++b[0];b[0]%=p;
        int base = 1;
        for(int j=0;j<p;++j){
            b[p-1-j]-=getc(j)*base%p;
            b[p-1-j]%=p;
            base*=-i;base%=p;
        }
    }

    for(int i=0;i<p;++i){
        if(b[i]<0) b[i]+=p;
        printf("%d ",b[i]);
    }
    printf("\n");
    return 0;
}
