#include<bits/stdc++.h>
using namespace std;
#define MD 1000000007
struct modint{
  static unsigned md;
  unsigned val;
  modint(){
  }
  modint(int a){
    val = ord(a);
  }
  modint(unsigned a){
    val = ord(a);
  }
  modint(long long a){
    val = ord(a);
  }
  modint(unsigned long long a){
    val = ord(a);
  }
  void setmod(unsigned m){
    md = m;
  }
  unsigned ord(unsigned a){
    return a%md;
  }
  unsigned ord(int a){
    a %= md;
    if(a < 0){
      a += md;
    }
    return a;
  }
  unsigned ord(unsigned long long a){
    return a%md;
  }
  unsigned ord(long long a){
    a %= md;
    if(a < 0){
      a += md;
    }
    return a;
  }
  unsigned get(){
    return val;
  }
  modint &operator+=(modint a){
    val += a.val;
    if(val >= md){
      val -= md;
    }
    return *this;
  }
  modint &operator-=(modint a){
    if(val < a.val){
      val = val + md - a.val;
    }
    else{
      val -= a.val;
    }
    return *this;
  }
  modint &operator*=(modint a){
    val = ((unsigned long long)val*a.val)%md;
    return *this;
  }
  modint &operator/=(modint a){
    return *this *= a.inverse();
  }
  modint operator+(modint a){
    return modint(*this)+=a;
  }
  modint operator-(modint a){
    return modint(*this)-=a;
  }
  modint operator*(modint a){
    return modint(*this)*=a;
  }
  modint operator/(modint a){
    return modint(*this)/=a;
  }
  modint operator+(int a){
    return modint(*this)+=modint(a);
  }
  modint operator-(int a){
    return modint(*this)-=modint(a);
  }
  modint operator*(int a){
    return modint(*this)*=modint(a);
  }
  modint operator/(int a){
    return modint(*this)/=modint(a);
  }
  modint operator+(long long a){
    return modint(*this)+=modint(a);
  }
  modint operator-(long long a){
    return modint(*this)-=modint(a);
  }
  modint operator*(long long a){
    return modint(*this)*=modint(a);
  }
  modint operator/(long long a){
    return modint(*this)/=modint(a);
  }
  modint operator-(void){
    modint res;
    if(val){
      res.val=md-val;
    }
    else{
      res.val=0;
    }
    return res;
  }
  operator bool(void){
    return val!=0;
  }
  operator int(void){
    return get();
  }
  operator long long(void){
    return get();
  }
  modint inverse(){
    int a=val, b=md, t, u=1, v=0;
    modint res;
    while(b){
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    if(u < 0){
      u += md;
    }
    res.val = u;
    return res;
  }
  modint pw(unsigned long long b){
    modint a(*this), res;
    res.val = 1;
    while(b){
      if(b&1){
        res *= a;
      }
      b >>= 1;
      a *= a;
    }
    return res;
  }
  bool operator==(int a){
    return ord(a)==val;
  }
  bool operator!=(int a){
    return ord(a)!=val;
  }
}
;
modint operator+(int a, modint b){
  return modint(a)+=b;
}
modint operator-(int a, modint b){
  return modint(a)-=b;
}
modint operator*(int a, modint b){
  return modint(a)*=b;
}
modint operator/(int a, modint b){
  return modint(a)/=b;
}
modint operator+(long long a, modint b){
  return modint(a)+=b;
}
modint operator-(long long a, modint b){
  return modint(a)-=b;
}
modint operator*(long long a, modint b){
  return modint(a)*=b;
}
modint operator/(long long a, modint b){
  return modint(a)/=b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(modint &x){
  int i;
  rd(i);
  x=i;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(modint x){
  int i;
  i = (int)x;
  wt_L(i);
}
unsigned modint::md;
int P;
modint X[3000];
modint Y[3000];
modint res[3000];
modint c[3000];
modint cur[3000];
int cs;
int main(){
  int i, j, k;
  {
    modint x;
    x.setmod(MD);
  }
  rd(P);
  X[0].setmod(P);
  for(i=0;i<(P);i++){
    X[i] = i;
  }
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(P);Lj4PdHRW++){
      rd(Y[Lj4PdHRW]);
    }
  }
  for(i=0;i<(P);i++){
    c[i] = Y[i];
  }
  for(i=(1);i<(P);i++){
    for(j=P-1;j>=i;j--){
      c[j] = (c[j]-c[j-1]) / (X[j] - X[j-i]);
    }
  }
  cs = 0;
  cur[0] = 1;
  for(i=0;i<(P);i++){
    for(j=0;j<(cs+1);j++){
      res[j] += c[i] * cur[j];
    }
    cs++;
    for(j=cs;j;j--){
      cur[j] = cur[j-1] - X[i] * cur[j];
    }
    cur[0] *= -X[i];
  }
  {
    int KL2GvlyY;
    if(P==0){
      putchar_unlocked('\n');
    }
    else{
      for(KL2GvlyY=0;KL2GvlyY<(P-1);KL2GvlyY++){
        wt_L(res[KL2GvlyY]);
        wt_L(' ');
      }
      wt_L(res[KL2GvlyY]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190810-2

// --- original code ---
// int P;
// modint X[3000], Y[3000];
// 
// modint res[3000], c[3000];
// modint cur[3000]; int cs;
// {
//   int i, j, k;
// 
//   rd(P);
//   X[0].setmod(P);
// 
//   rep(i,P) X[i] = i;
//   rd(Y(P));
// 
//   rep(i,P) c[i] = Y[i];
//   rep(i,1,P){
//     for(j=P-1;j>=i;j--){
//       c[j] = (c[j]-c[j-1]) / (X[j] - X[j-i]);
//     }
//   }
// 
//   cs = 0;
//   cur[0] = 1;
//   rep(i,P){
//     rep(j,cs+1) res[j] += c[i] * cur[j];
//     cs++;
//     for(j=cs;j;j--){
//       cur[j] = cur[j-1] - X[i] * cur[j];
//     }
//     cur[0] *= -X[i];
//   }
// 
//   wt(res(P));
// }


Measured memory_bytes: 256