#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N,MOD;
const ll FACN = 3005;
vector<ll> fact(FACN,1),factinv(FACN,1);
ll getPow(ll a,ll p){
  ll ret = 1,cp = a;
  while(p){
    if(p&1) ret = (ret*cp)%MOD;
    p >>= 1;
    cp = (cp*cp)%MOD;
  }
  return ret;
}
ll getInverse(ll a){
  return getPow(a,MOD-2)%MOD;
}
void init(ll l){
  for(ll i = 1; i < l; ++i){
    fact[i] = (fact[i-1]*i)%MOD;
    factinv[i] = (factinv[i-1]*getInverse(i))%MOD;
  }
}
ll C2(ll a,ll b){
  ll ans = fact[a+b];
  ans = (ans*factinv[a])%MOD;
  ans = (ans*factinv[b])%MOD;
  return ans;
}
ll C(ll n,ll a){
  return C2(a,n-a);
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll p;
  cin >> p;
  MOD = p;
  N = MOD;
  init(FACN);
  vector<ll> a(N),b(N);
  for(ll i = 0; i < N; ++i) cin >> a[i], b[0] += a[i];
  // f = sum_0^{N-1} a[i]*(1-(x-i)^(p-1))
  for(ll i = 0; i < N; ++i){
    ll tmp = 0;
    for(ll j = 0; j < N; ++j){
      tmp = (tmp-a[j]*C(N-1,i)*getPow(-j,N-1-i))%MOD;
    }
    b[i] = (b[i]+tmp)%MOD;
    cout << (b[i]+MOD)%MOD << ' ';
  }
  return 0;
}