#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

//負数の合同も考慮に入れるmod関数
inline long long imod(long long a, long long b)
{
	return (a >= 0) ? (a % b) : (a % b + b);
}

//mintが引数の繰り返し2乗法
class mint;
mint pow(mint x, long long n);

//modの整数クラス
class mint
{
public:
	static void set_mod(long long m_)
	{
		//無効な値は無視
		if (m_ < 2)return;
		//modの値を更新
		mod = m_;
		//オイラー関数Φ(mod)を計算する
		e_phi = m_;
		for (int i = 2; i * i <= m_; ++i)
		{
			if (m_ % i == 0)
			{
				e_phi = e_phi / i * (i - 1);
				for (; m_ % i == 0; m_ /= i);
			}
		}
		if (m_ != 1)e_phi = e_phi / m_ * (m_ - 1);
	}
	mint operator+(const mint & other)const
	{
		return mint(a + other.a >= mod ? a + other.a - mod : a + other.a, true);
	}
	mint operator-(const mint & other)const
	{
		return mint(a - other.a < 0 ? a - other.a + mod : a - other.a, true);
	}
	mint operator*(const mint & other)const
	{
		return mint(imod(a * other.a, mod));
	}
	mint operator+=(const mint & other)
	{
		a = a + other.a >= mod ? a + other.a - mod : a + other.a;
		return mint(a, true);
	}
	mint operator-=(const mint & other)
	{
		a = a - other.a < 0 ? a - other.a + mod : a - other.a;
		return mint(a, true);
	}
	mint operator*=(const mint & other)
	{
		a = imod(a * other.a, mod);
		return mint(a);
	}
	mint operator+()const
	{
		return *this;
	}
	mint operator-()const
	{
		return mint(mod - a >= mod ? -a : mod - a, true);
	}
	mint& operator++()
	{
		*this += 1;
		return *this;
	}
	mint operator++(int)
	{
		auto tmp = *this;
		*this += 1;
		return tmp;
	}
	mint& operator--()
	{
		*this -= 1;
		return *this;
	}
	mint operator--(int)
	{
		auto tmp = *this;
		*this -= 1;
		return tmp;
	}
	mint operator~()const
	{
		return pow(*this, e_phi - 1);
	}
	mint& operator=(const mint & other)
	{
		a = other.a;
		return *this;
	}
	operator long long()const
	{
		return a;
	}
	explicit operator int()const
	{
		return (int)a;
	}
	static long long getmod()
	{
		return mod;
	}
	mint(long long a_) :a(imod(a_, mod)) {}
	mint() :a(0) {}
private:
	static long long mod;
	static long long e_phi;
	long long a;
	mint(long long a_, bool) : a(a_) {}
};

//mintの累乗
//x^nを計算します
mint pow(mint x, long long n)
{
	mint res = 1;
	while (n > 0)
	{
		if (n & 1)res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}

#include <vector>
mint minv[3333];

//mintの階乗計算
//O(x)程度の時間がかかります
//非推奨、同時間でfact_setが計算可能
mint fact(mint x)
{
	mint res(1);
	for (long long i = 1; i <= (long long)x; ++i)
	{
		res *= i;
	}
	return res;
}

//mintの階乗計算のリスト
//setの末尾に0～xまでの階乗数の列挙をします
//O(x)程度の時間がかかります
void fact_set(std::vector<mint> & set, mint x = mint(-1))
{
	mint res(1);
	set.push_back(1);
	for (long long i = 1; i <= (long long)x; ++i)
	{
		res *= i;
		set.push_back(res);
	}
}

long long mint::mod = 1000000000 + 7;
long long mint::e_phi = mod - 1;

#include<iostream>

//mint型のstreamへの入出力対応
std::ostream& operator<<(std::ostream & os, mint i)
{
	os << (long long)i;
	return os;
}

std::istream& operator >> (std::istream & is, mint & i)
{
	long long tmp;
	is >> tmp;
	i = tmp;
	return is;
}

using Poly = vector<mint>;

Poly operator*(const Poly & p1, const Poly & p2) {
	Poly res(p1.size() + p2.size() - 1);
	for (int j = 0; j < p2.size(); ++j) {
		for (int i = 0; i < p1.size(); ++i) {
			res[i + j] += p1[i] * p2[j];
		}
	}
	return res;
}

Poly operator/(const Poly & p1, const Poly & p2) {
	Poly p3 = p1;
	Poly res(p1.size() + 1 - p2.size());
	for (int i = res.size() - 1; i >= 0; --i) {
		res[i] = p3[p2.size() - 1 + i] * minv[p2[p2.size() - 1]];
		for (int j = i; j < i + p2.size(); ++j) {
			p3[j] -= res[i] * p2[j - i];
		}
	}
	return res;
}

mint calc(const Poly & pol, mint x) {
	mint ans = 0;
	mint tak = 1;
	for (int i = 0; i < pol.size(); ++i) {
		ans += tak * pol[i];
		tak *= x;
	}
	return ans;
}

LL p;

int main() {
	cin >> p;
	mint::set_mod(p);
	for (int i = 0; i < p; ++i) {
		minv[i] = ~mint(i);
	}
	vector<Poly>vec;
	vector<mint>a;
	for (int i = 0; i < p; ++i) {
		mint aa; cin >> aa;
		a.push_back(aa);
		vec.push_back({ mint(-i),1 });
	}
	Poly fac = vec[0];
	for (int i = 1; i < p; ++i) {
		fac = fac * vec[i];
	}
	Poly ans(p);
	for (int i = 0; i < p; ++i) {
		Poly gi = fac / vec[i];
		mint val = calc(gi, i);
		for (auto& elm : gi) {
			if (val == 0) {
				assert(a[i] == 0);
				elm = 0;
			}
			else {
				elm *= a[i] * minv[val];
			}
		}
		for (int j = 0; j < p; ++j) {
			ans[j] += gi[j];
		}
	}
	for (int i = 0; i < ans.size(); ++i) {
		cout << ans[i] << " \n"[i + 1 == ans.size()];
	}

}


Measured memory_bytes: 768