#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

Int MOD;
template<typename T>
struct Mint{
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

};


namespace FFT{
  using dbl = double;

  struct num{
    dbl x,y;
    num(){x=y=0;}
    num(dbl x,dbl y):x(x),y(y){}
  };

  inline num operator+(num a,num b){
    return num(a.x+b.x,a.y+b.y);
  }
  inline num operator-(num a,num b){
    return num(a.x-b.x,a.y-b.y);
  }
  inline num operator*(num a,num b){
    return num(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x);
  }
  inline num conj(num a){
    return num(a.x,-a.y);
  }

  Int base=1;
  vector<num> rts={{0,0},{1,0}};
  vector<Int> rev={0,1};

  const dbl PI=acosl(-1.0);

  void ensure_base(Int nbase){
    if(nbase<=base) return;

    rev.resize(1<<nbase);
    for(Int i=0;i<(1<<nbase);i++)
      rev[i]=(rev[i>>1]>>1)+((i&1)<<(nbase-1));

    rts.resize(1<<nbase);
    while(base<nbase){
      dbl angle=2*PI/(1<<(base+1));
      for(Int i=1<<(base-1);i<(1<<base);i++){
        rts[i<<1]=rts[i];
        dbl angle_i=angle*(2*i+1-(1<<base));
        rts[(i<<1)+1]=num(cos(angle_i),sin(angle_i));
      }
      base++;
    }
  }

  void fft(vector<num> &a,Int n=-1){
    if(n==-1) n=a.size();
    assert((n&(n-1))==0);

    Int zeros=__builtin_ctz(n);
    ensure_base(zeros);
    Int shift=base-zeros;
    for(Int i=0;i<n;i++)
      if(i<(rev[i]>>shift))
        swap(a[i],a[rev[i]>>shift]);

    for(Int k=1;k<n;k<<=1){
      for(Int i=0;i<n;i+=2*k){
        for(Int j=0;j<k;j++){
          num z=a[i+j+k]*rts[j+k];
          a[i+j+k]=a[i+j]-z;
          a[i+j]=a[i+j]+z;
        }
      }
    }
  }

  vector<num> fa;

  vector<Int> multiply(vector<Int> &a,vector<Int> &b){
    Int need=a.size()+b.size()-1;
    Int nbase=0;
    while((1<<nbase)<need) nbase++;
    ensure_base(nbase);

    Int sz=1<<nbase;
    if(sz>(Int)fa.size()) fa.resize(sz);
    for(Int i=0;i<sz;i++){
      Int x=(i<(Int)a.size()?a[i]:0);
      Int y=(i<(Int)b.size()?b[i]:0);
      fa[i]=num(x,y);
    }
    fft(fa,sz);

    num r(0,-0.25/sz);
    for(Int i=0;i<=(sz>>1);i++){
      Int j=(sz-i)&(sz-1);
      num z=(fa[j]*fa[j]-conj(fa[i]*fa[i]))*r;
      if(i!=j)
        fa[j]=(fa[i]*fa[i]-conj(fa[j]*fa[j]))*r;
      fa[i]=z;
    }
    fft(fa,sz);

    vector<Int> res(need);
    for(Int i=0;i<need;i++)
      res[i]=fa[i].x+0.5;

    return res;
  }

};

//INSERT ABOVE HERE
signed main(){
  Int p;
  cin>>p;
  MOD=p;
  vector<Int> as(p);
  for(Int i=0;i<p;i++) cin>>as[i];

  vector< vector<Int> > num;
  for(Int i=0;i<p;i++)
    num.emplace_back(vector<Int>({i?p-i:0,1}));

  vector< vector<Int> > accL,accR;
  auto mul=
    [&](const vector<Int> &as,const vector<Int> &bs){
      vector<Int> cs(as.size()+bs.size()-1,0);
      for(Int i=0;i<(Int)as.size();i++)
        for(Int j=0;j<(Int)bs.size();j++)
          cs[i+j]+=as[i]*bs[j];
      for(Int i=0;i<(Int)cs.size();i++) cs[i]%=p;
      return cs;
    };

  for(Int k=0;k<2;k++){
    auto &acc=(k==0?accL:accR);
    acc.emplace_back(vector<Int>({1}));
    for(Int i=0;i<p;i++){
      auto res=mul(acc.back(),num[i]);
      acc.emplace_back(res);
    }
    reverse(num.begin(),num.end());
  }
  reverse(accR.begin(),accR.end());

  using M = Mint<Int>;
  vector<M> dp(p,0);
  for(Int i=0;i<p;i++){
    if(as[i]==0) continue;
    M cof{1};
    for(Int j=0;j<p;j++)
      if(i!=j) cof*M(i-j);
    auto res=FFT::multiply(accL[i],accR[i+1]);
    cof=cof.inv();
    for(Int j=0;j<p;j++)
      dp[j]-=M(res[j])*cof;
  }
  for(Int i=0;i<p;i++){
    if(i) cout<<" ";
    cout<<dp[i].v;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 94848