// includes
#include <bits/stdc++.h>
using namespace std;

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;

int MOD = 2;
ll inve[3010];

struct ModInt {
  ll x = 0;
  ModInt(){}
  ModInt(ll x_){
    x = int(x_ % MOD);
    if(x < 0)x += MOD;
  }
  void set_mod(int m){
    MOD = m;
  }
  ModInt(const ModInt &m){
    x = m.x;
  }
  ModInt& operator+=(const ModInt &y){
    x = (x + y.x) % MOD;
    if(x < 0)x += MOD;
    return *this;
  }
  ModInt& operator-=(const ModInt &y){
    x = (x - y.x) % MOD;
    if(x < 0)x += MOD;
    return *this;
  }
  ModInt& operator*=(const ModInt &y){
    x = (x * y.x) % MOD;
    if(x < 0)x += MOD;
    return *this;
  }
  ModInt& operator/=(const ModInt &y){
    x = (x * y.inverse().x) % MOD;
    if(x < 0)x += MOD;
    return *this;
  }
  ModInt inverse() const{
    /*ll res = 1;
    ll tmp = MOD - 2;
    ll curr = x;
    while(tmp){
      if(tmp % 2 == 1)res = res * curr % MOD;
      curr = curr * curr % MOD;
      tmp /= 2;
      }
      return ModInt(res);*/
    return ModInt(inve[x]);
  }
  ModInt operator-() const{
    return ModInt(-x);
  }
  ModInt operator+(const ModInt &y) const{
    return ModInt(*this) += y;
  }
  ModInt operator-(const ModInt &y) const{
    return ModInt(*this) -= y;
  }
  ModInt operator*(const ModInt &y) const{
    return ModInt(*this) *= y;
  }
  ModInt operator/(const ModInt &y) const{
    return ModInt(*this) /= y;
  }
  bool operator==(const ModInt &y) const{
    return x == y.x;
  }
  bool operator!=(const ModInt &y) const{
    return x != y.x;
  }
  friend ostream& operator<<(ostream &os, const ModInt &m){
    return os << m.x;
  }
  friend istream& operator>>(istream &is, ModInt &m){
    long t;
    is >> t;
    m = ModInt(t);
    return is;
  }
};

template <typename T>
struct LagrangeInterpolationN{
  int n = 0;
  vector<T> ifrac;
  vector<T> y;
  vector<T> coeff;
  LagrangeInterpolationN(const vector<T> &y): y(y){
    n = y.size() - 1;
    ifrac.resize(n + 1);
    coeff.resize(n + 1);
    ifrac[0] = T(1);
    for(int i = 1; i <= n; i++){
      ifrac[i] = T(i) * ifrac[i-1];
    }
    for(int i = 0; i <= n; i++)ifrac[i] = ifrac[i].inverse();
    for(int i = 0; i <= n; i++){
      T tmp = y[i] * ifrac[i] * ifrac[n-i];
      if((n-i) % 2 == 1)tmp *= T(-1);
      coeff[i] = tmp;
    }
  }
  T val(int t){
    if(t >= 0 && t <= n)return y[t];
    T a = T(1);
    for(int i = 0; i <= n; i++){
      a = a * T(t - i);
    }
    T res = T(0);
    for(int i = 0; i <= n; i++){
      res += a * coeff[i] / T(t - i);
    }
    return res;
  }
};


template <typename T>
T power(T a, T n, T mod) {
  T res = 1;
  T tmp = n;
  T curr = a;
  while(tmp){
    if(tmp % 2 == 1){
      res = (T)(res * curr % mod);
    }
    curr = (T)(curr * curr % mod);
    tmp >>= 1;
  }

  return res;
}

template<typename T>
T extgcd(T a, T b, T &x, T &y){ 
  T d = a;
  if(b != 0){
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  }else{
    x = 1, y = 0;
  }
  return d;
}

template <typename T>
T modinv(T a, T m){
  long long x = 0, y = 0;
  extgcd<long long>(a, m, x, y);
  x %= m;
  if(x < 0)x += m;
  return x;
}


ll al[3010][3010];

int main(int argc, char const* argv[])
{
  ll p;
  cin >> p;
  MOD = p;
  vector<ll> a(p); cin >> a;
  vector<ll> b(p);
  b[0] = a[0];
  rep(i, p)al[0][i] = b[0];
  FOR(i, 1, p)inve[i] = modinv<ll>(i, p);
  vector<ModInt> mul(p, 1);
  vector<ll> mal(p, 1);
  FOR(i, 1, p){
    vector<ModInt> y(p-i);
    rep(j, p)mul[j] = mul[j] * ModInt(inve[j]);
    rep(j, p)mal[j] = mal[j] * j % p;
    for(int j = p - i; j > 0; j--){
      ModInt f = ModInt(a[j]) - ModInt(al[i-1][j]);
      y[j-1] = f * mul[j];
    }
    LagrangeInterpolationN<ModInt> li(y);
    b[i] = li.val(p-1).x;
    rep(j, p){
      al[i][j] = (al[i-1][j] + b[i] * mal[j] % p) % p;
    }
  }

  cout << b << endl;
  return 0;
}


Measured memory_bytes: 71168