var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var mod, fac=[], finv = [];
function fSet(n){
  fac.length = finv.length = n+1;
  fac[0] = finv[0] = 1;
  for(var i=1;i<=n;i++)fac[i]=fac[i-1]*i%mod;
  finv[n] = modinv(fac[n]);
  for(var i=n;i>1;i--)finv[i-1]=finv[i]*i%mod;
}
function modinv(a){for(var b=mod,u=1,v=0,t;b;v=t)t=a/b|0,a-=t*b,u-=t*v,t=a,a=b,b=t,t=u,u=v;u%=mod;return u<0?u+mod:u;}
function nCrmod(n,r){return fac[n]*finv[r]*finv[n-r]%mod;}

console.log(main());
function main(){
  var p = o.a();
  var a = o.l();
  mod = p;
  var p1 = p-1;
  fSet(p1);
  var xpow = [];
  xpow.length = p;
  xpow[0] = 1;
  var ans = xArray(0,p);
  if(a[0])ans[0] = 1, ans[p1] = -1;
  for(var i = 1; i < p; i++){
    if(a[i] === 0)continue;
    for(var j = 1; j < p; j++)xpow[j] = -xpow[j-1] * i % p;
    for(var j = 1; j < p; j++){
      var t = -nCrmod(p1,j)*xpow[p1-j]%p+p;
      if(t >= p)t -= p;
      ans[j] += t;
    }
  }
  return ans.map(a=>(a%p+p)%p).join(" ")
}