#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define MD 1000000007
void *wmem;
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16]={0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
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);
}
template<class S, class T> inline S chmax(S &a, T b){
  if(a<b){
    a=b;
  }
  return a;
}
template<class T> struct Polynomial{
  T *c;
  int d, mem;
  Polynomial(){
    mem = 1;
    c = new T[mem];
    d = 0;
    c[0] = 0;
  }
  Polynomial(const Polynomial<T> &a){
    int i;
    d = a.d;
    mem = d + 1;
    c = new T[mem];
    for(i=0;i<(d+1);i++){
      c[i] = a.c[i];
    }
  }
  ~Polynomial(){
    delete [] c;
  }
  void expand(int z){
    T *cc;
    int i;
    if(z <= mem){
      return;
    }
    chmax(z, 2* mem);
    cc = new T[z];
    for(i=0;i<(d+1);i++){
      cc[i] = c[i];
    }
    delete [] c;
    c = cc;
  }
  inline void change(const int dg, const T cf){
    expand(dg+1);
    while(d < dg){
      c[++d] = 0;
    }
    c[dg] = cf;
    while(d && c[d]==0){
      d--;
    }
  }
  inline int deg(void){
    return d;
  }
  inline T coef(const int k){
    if(k > d){
      return 0;
    }
    return c[k];
  }
  Polynomial<T>& operator=(const Polynomial<T> &a){
    int i;
    d = a.d;
    mem = d + 1;
    c = new T[mem];
    for(i=0;i<(d+1);i++){
      c[i] = a.c[i];
    }
    return *this;
  }
  Polynomial<T>& operator+=(const Polynomial<T> &a){
    int i, k;
    k =max_L(d, a.d);
    expand(k+1);
    while(d < k){
      c[++d] = 0;
    }
    for(i=0;i<(a.d+1);i++){
      c[i] += a.c[i];
    }
    while(d && c[d]==0){
      d--;
    }
    return *this;
  }
  Polynomial<T> operator+(const Polynomial<T> &a){
    return Polynomial<T>(*this) += a;
  }
  Polynomial<T>& operator-=(const Polynomial<T> &a){
    int i, k;
    k =max_L(d, a.d);
    expand(k+1);
    while(d < k){
      c[++d] = 0;
    }
    for(i=0;i<(a.d+1);i++){
      c[i] -= a.c[i];
    }
    while(d && c[d]==0){
      d--;
    }
    return *this;
  }
  Polynomial<T> operator-(const Polynomial<T> &a){
    return Polynomial<T>(*this) -= a;
  }
  Polynomial<T>& operator*=(const Polynomial<T> &a){
    T *cc;
    int i, j, k;
    void *mem=wmem;
    k = d + a.d;
    expand(k+1);
    walloc1d(&cc, k+1, &mem);
    for(i=0;i<(k+1);i++){
      cc[i] = 0;
    }
    for(i=0;i<(d+1);i++){
      for(j=0;j<(a.d+1);j++){
        cc[i+j] += c[i] * a.c[j];
      }
    }
    for(i=0;i<(k+1);i++){
      c[i] = cc[i];
    }
    d = k;
    while(d && c[d]==0){
      d--;
    }
    return *this;
  }
  Polynomial<T> operator*(const Polynomial<T> &a){
    return Polynomial<T>(*this) *= a;
  }
  Polynomial<T>& operator/=(const Polynomial<T> &a){
    T *cc, e;
    int i, j, k;
    void *mem=wmem;
    walloc1d(&cc, d-a.d, &mem);
    for(i=d; i>=a.d; i--){
      cc[i-a.d] = e = c[i] / a.c[a.d];
      for(j=0;j<(a.d+1);j++){
        c[i-j] -= e * a.c[a.d-j];
      }
    }
    d -= a.d;
    for(i=0;i<(d+1);i++){
      c[i] = cc[i];
    }
    return *this;
  }
  Polynomial<T> operator/(const Polynomial<T> &a){
    return Polynomial<T>(*this) /= a;
  }
  Polynomial<T>& operator%=(const Polynomial<T> &a){
    T *cc, e;
    int i, j, k;
    void *mem=wmem;
    walloc1d(&cc, d-a.d, &mem);
    for(i=d; i>=a.d; i--){
      cc[i-a.d] = e = c[i] / a.c[a.d];
      for(j=0;j<(a.d+1);j++){
        c[i-j] -= e * a.c[a.d-j];
      }
    }
    while(d && c[d]==0){
      d--;
    }
    return *this;
  }
  Polynomial<T> operator%(const Polynomial<T> &a){
    return Polynomial<T>(*this) %= a;
  }
  Polynomial<T>& operator*=(const T &a){
    int i;
    for(i=0;i<(d+1);i++){
      c[i] *= a;
    }
    while(d && c[d]==0){
      d--;
    }
    return *this;
  }
  Polynomial<T> operator*(const T &a){
    return Polynomial<T>(*this) *= a;
  }
  Polynomial<T>& operator/=(const T &a){
    int i;
    for(i=0;i<(d+1);i++){
      c[i] /= a;
    }
    while(d && c[d]==0){
      d--;
    }
    return *this;
  }
  Polynomial<T> operator/(const T &a){
    return Polynomial<T>(*this) /= a;
  }
  inline T operator()(const T x){
    T res;
    int i;
    res = 0;
    for(i=d;i>=0;i--){
      res = res * x + c[i];
    }
    return res;
  }
}
;
template<class T> Polynomial<T> operator*(const T a, const Polynomial<T> &b){
  return Polynomial<T>(b)*=a;
}
template<class T> Polynomial<T> polationPoly_L(int n, T x[], T y[]){
  Polynomial<T> res, t1, tmp;
  T c;
  int i, j;
  tmp.change(0, 1);
  t1.change(1, 1);
  for(i=0;i<(n);i++){
    t1.change(0, -x[i]);
    tmp *= t1;
  }
  for(i=0;i<(n);i++){
    c = 1;
    for(j=0;j<(n);j++){
      if(j!=i){
        c *= (x[i] - x[j]);
      }
    }
    c = y[i] / c;
    t1.change(0, -x[i]);
    res += c * tmp / t1;
  }
  return res;
}
char memarr[96000000];
unsigned modint::md;
int P;
modint X[3000];
modint Y[3000];
modint res[3000];
int main(){
  Polynomial<modint> poly;
  int i;
  wmem = memarr;
  {
    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]);
    }
  }
  poly =polationPoly_L(P, X, Y);
  for(i=0;i<(P);i++){
    res[i] = poly.coef(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 20190902-1

// --- original code ---
// int P;
// modint X[3000], Y[3000];
// 
// modint res[3000];
// {
//   int i;
//   Polynomial<modint> poly;
// 
//   rd(P);
//   X[0].setmod(P);
// 
//   rep(i,P) X[i] = i;
//   rd(Y(P));
// 
//   poly = polationPoly(P, X, Y);
//   rep(i,P) res[i] = poly.coef(i);
// 
//   wt(res(P));
// }


Measured memory_bytes: 384