#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << endl;
#else
	#define DBG(X)
	#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

const int MAX_P = 3007;

int p;

inline int add(int x, int y)
{
	int r = x + y;

	return (r >= p ? r - p : r);
}

inline int sub(int x, int y)
{
	int r = x - y;

	return (r < 0 ? r + p : r);
}

inline int mult(int x, int y)
{
	return (x * y) % p;
}

int binpow(int x, int y)
{
	if(!y)
		return 1;

	int ret = binpow(x, y / 2);
	ret = mult(ret, ret);

	if(y & 1)
		ret = mult(ret, x);

	return ret;
}

int inv(int x)
{
	return binpow(x, p - 2);		
}

struct Poly
{
	int coeff[MAX_P];

	Poly()
	{
		memset(coeff, 0, sizeof(coeff));
	}

	inline Poly operator+(const Poly& other) const
	{
		Poly answ;

		for(int i = 0; i < p; ++i)
			answ.coeff[i] = add(coeff[i], other.coeff[i]);

		return answ;
	}

	inline Poly operator*(const Poly& other) const
	{
		Poly answ;

		for(int i = 0; i < p; ++i)
		{
			for(int j = 0; j < p; ++j)
			{
				int k = i + j;

				while(k >= p)
					k -= p - 1;

				answ.coeff[k] = add(answ.coeff[k], mult(coeff[i], other.coeff[j]));
			}
		}

		return answ;
	}

	inline int compute(int x)
	{
		int answ = 0;

		for(int i = p - 1; i >= 0; --i)
		{
			answ = mult(answ, x);
			answ = add(answ, coeff[i]);
		}

		return answ;
	}
};

Poly binpow(Poly x, int y)
{
	if(!y)
	{
		Poly neu;
		neu.coeff[0] = 1;

		return neu;
	}

	Poly ret = binpow(x, y / 2);
	ret = ret * ret;

	if(y & 1)
		ret = ret * x;

	return ret;
}

int fact[MAX_P], invfact[MAX_P];

inline Poly build_g(int a)
{
	Poly answ;
	a = sub(0, a % p);
	int pw = binpow(a, p - 1);
	int iv = inv(a);

	for(int i = 0; i < p; ++i)
	{
		int c = fact[p - 1];
		c = mult(c, invfact[i]);
		c = mult(c, invfact[p - 1 - i]);
		//c = mult(c, binpow(a, p - 1 - i));
		c = mult(c, (p - 1 - i == 0 ? 1 : pw));

		answ.coeff[i] = c;
		pw = mult(pw, iv);
	}

	return answ;
}

inline Poly build_f(int a)
{
	Poly answ = build_g(a);

	for(int i = 0; i < p; ++i)
		answ.coeff[i] = sub(0, answ.coeff[i]);

	answ.coeff[0] = add(answ.coeff[0], 1);

	return answ;
}

void solve()
{
	cin >> p;

	fact[0] = 1;
	invfact[0] = 1;

	for(int i = 1; i < MAX_P; ++i)
	{
		fact[i] = mult(i, fact[i - 1]);
		invfact[i] = inv(fact[i]);
	}

	Poly answ;

	for(int i = 0; i < p; ++i)
	{
		int a;
		cin >> a;

		if(a)
			answ = answ + build_f(i);
	}

	for(int i = 0; i < p; ++i)
		cout << answ.coeff[i] << " ";

	cout << endl;

#ifdef __LOCAL

	for(int i = 0; i < p; ++i)
		cout << i << " -> " << answ.compute(i) << endl;

#endif
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 384