using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		mlong.mod = P;
		int N = P;
		mlong[][] p = new mlong[N][];
		
		// p0 = x (x - 1) (x - 2)...(x - p - 1)
		mlong[] p0 = new mlong[N + 1];
		p0[0] = 1;
		for(int j=0;j<N;j++){
			var np0 = new mlong[N + 1];
			for(int i=0;i<=N;i++){
				if(p0[i] == 0) continue;
				np0[i + 1] += p0[i];
				np0[i] += -j * p0[i];
			}
			p0 = np0;
		}
//Console.WriteLine(String.Join(" ",p0));
		for(int i=0;i<N;i++){
			p[i] = new mlong[N];
			if(A[i] == 0) continue;
			// https://mathtrain.jp/hokan
			// p0 = x (x - 1) (x - 2)...(x - p - 1) を
			// (x - i) で多項式割り算する
			mlong[] fi = new mlong[N];
			mlong res = 0;
			for(int j=N-1;j>=0;j--){
				mlong x1 = p0[j + 1] - res;
				mlong x0 = p0[j];
//Console.WriteLine("x1:{0}, x0:{1}",x1, x0);
				fi[j] = x1;
				res = fi[j] * (-i);
			}
			
//Console.WriteLine("i:{0}, fi:{1}",i, String.Join(" ",fi));
			// fi[x_i = i]:
			mlong v = 0;
			mlong x = 1;
			for(int j=0;j<N;j++){
				v += x * fi[j];
				x *= i;
			}
//Console.WriteLine("fi[i]:{0}",v);
			// fi / fi[i]
			mlong inv = 1 / v;
			for(int j=0;j<N;j++) fi[j] *= inv;
//Console.WriteLine("fi:{0}",String.Join(" ",fi));			
			// pi = fi;
			for(int j=0;j<N;j++) p[i][j] = fi[j];
		}
//for(int i=0;i<N;i++) Console.WriteLine("p[{0}]: {1}",i, String.Join(" ",p[i]));		
		mlong[] ans = new mlong[N];
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				ans[i] += p[j][i];
			}
		}
		Console.WriteLine(String.Join(" ",ans));
		
	}
	int P;
	int[] A;
	public Sol(){
		P = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


struct mlong {
	
	public static long mod = (long) 1e9 + 7;
	long V;
	
	public mlong(long _v = 0){
		V = _v;
	}
	
	public static mlong operator+(mlong a, mlong b){
		var v0 = a.V + b.V; if(v0 >= mod) v0 -= mod;
		return new mlong(v0);
	}
	public static mlong operator-(mlong a, mlong b){
		var v0 = mod + a.V - b.V; if(v0 >= mod) v0 -= mod;
		return new mlong(v0);
	}
	public static mlong operator*(mlong a, mlong b){
		var v0 = a.V * b.V; if(v0 >= mod) v0 %= mod;
		return new mlong(v0);
	}
	public static mlong operator/(mlong a, mlong b){
		var v0 = a.V * inv(b.V).V; if(v0 >= mod) v0 %= mod;
		return new mlong(v0);
	}
	
	
	public static mlong inv(long x){
		long a = 0, b = 0, c = 0;
		ExtGCD(x, mod, ref a, ref b, ref c);
		return (mlong)((a + mod) % mod);
	}
	
	public static void ExtGCD(long x, long y, ref long a, ref long b, ref long c){
		long r0 = x; long r1 = y;
		long a0 = 1; long a1 = 0;
		long b0 = 0; long b1 = 1;
		long q1, r2, a2, b2;
		while(r1 > 0){
			q1 = r0 / r1;
			r2 = r0 % r1;
			a2 = a0 - q1 * a1;
			b2 = b0 - q1 * b1;
			r0 = r1; r1 = r2;
			a0 = a1; a1 = a2;
			b0 = b1; b1 = b2;
		}
		c = r0;
		a = a0;
		b = b0;
	}
	
	public static mlong ModPow(mlong a, long k){
		if(k == 0) return (mlong) 1;
		if(a == 0) return (mlong) 0;
		mlong x = a;
		mlong ret = 1;
		while(k > 0){
			if(k % 2 == 1) ret *= x;
			x *= x;
			k >>= 1;
		}
		return ret;
	}
	
	
	public static bool operator == (mlong a, mlong b){
		 return a.Equals(b);
	}
	public static bool operator != (mlong a, mlong b){
		 return !(a == b);
	}
	
	public override bool Equals(System.Object obj){
		if(obj  ==  null) return false;
		mlong p  =  (mlong) obj;
		if((System.Object) p  ==  null) return false;
		return p.V  ==  V;
	}
	public override int GetHashCode(){
		return V.GetHashCode();
	}
	
	public static implicit operator mlong(long n){
		long v = n % mod; if(v < 0) v += mod;
		return new mlong(v);
	}
	public static implicit operator mlong(int n){
		long v = n % mod; if(v < 0) v += mod;
		return new mlong(v);
	}
	public static explicit operator long(mlong n){
		return n.V;
	}
	
	public override String ToString(){
		return V.ToString();
	}
	
	
}

Measured memory_bytes: 96692