#include<bits/stdc++.h>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll P,A[3333];
ll inv[3333];
ll poly[3333];
ll C[3333][3333];
ll i, j, k, ans;


ll moddiv(ll a,ll b){
    a %= P;
    b %= P;
    for(ll m=P-2;m>0;m/=2){
        if(m&1){
            a=a*b%P;
        }
        b=b*b%P;
    }
    return a;
}
int main(){
    scanf("%lld", &P);
    fornum(i,0,P){
        scanf("%lld", &A[i]);
    }
    C[0][0] = 1;
    fornum(i,0,P){
        C[i+1][0] = 1;
        fornum(j,0,P){
            C[i + 1][j + 1] = (C[i][j] + C[i][j + 1]) % P;
        }
    }

    fornum(i,0,P){
        ll a = 1;
        fornum(j,0,P){
            if(j%2)
                poly[P - 1 - j] = (poly[P - 1 - j] + C[P - 1][j] * a * A[i]) % P;
            else
                poly[P - 1 - j] = (poly[P - 1 - j] + (P - C[P - 1][j]) * a * A[i]) % P;
            a = (a * i) % P;
        }
        poly[0] = (poly[0] + A[i]) % P;
    }
    fornum(i,0,P){
            printf("%lld ", poly[i]);
        }
}