#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

struct RuntimeModInt {
public:
	using value_type = long long;
	
	RuntimeModInt(value_type val = 0) : val(val < 0 ? (mod() - (-val % mod())) % mod() : val % mod()) {}
	
	explicit operator bool() const noexcept { return val; }
	bool operator ==(const RuntimeModInt & rhs) const noexcept { return val == rhs.val; }
	bool operator !=(const RuntimeModInt & rhs) const noexcept { return !(*this == rhs); }
	RuntimeModInt operator +() const noexcept { return RuntimeModInt(*this); }
	RuntimeModInt operator -() const noexcept { return RuntimeModInt(0) -= *this; }
	RuntimeModInt operator +(const RuntimeModInt & rhs) const noexcept { return RuntimeModInt(*this) += rhs; }
	RuntimeModInt operator -(const RuntimeModInt & rhs) const noexcept { return RuntimeModInt(*this) -= rhs; }
	RuntimeModInt operator *(const RuntimeModInt & rhs) const noexcept { return RuntimeModInt(*this) *= rhs; }
	RuntimeModInt operator /(const RuntimeModInt & rhs) const noexcept { return RuntimeModInt(*this) /= rhs; }
	
	RuntimeModInt & operator +=(const RuntimeModInt & rhs) noexcept {
		val += rhs.val;
		if (val >= mod()) val -= mod();
		return *this;
	}
	RuntimeModInt & operator -=(const RuntimeModInt & rhs) noexcept {
		if (val < rhs.val) val += mod();
		val -= rhs.val;
		return *this;
	}
	RuntimeModInt & operator *=(const RuntimeModInt & rhs) noexcept {
		val = val * rhs.val % mod();
		return *this;
	}
	RuntimeModInt & operator /=(const RuntimeModInt & rhs) noexcept {
		*this *= rhs.inverse();
		return *this;
	}
	
	RuntimeModInt pow(value_type n) const {
		RuntimeModInt res = 1, x = val;
		if (n < 0) { x = x.inverse(); n = -n; }
		while (n) { if (n & 1) res *= x; x *= x; n >>= 1; }
		return res;
	}
	
	RuntimeModInt inverse() const {
		long long a = val, a1 = 1, a2 = 0, b = mod(), b1 = 0, b2 = 1;
		while (b > 0) {
			value_type q = a / b, r = a % b;
			value_type nb1 = a1 - q * b1, nb2 = a2 - q * b2;
			a = b; b = r;
			a1 = b1; b1 = nb1;
			a2 = b2; b2 = nb2;
		}
		assert(a == 1);
		return a1;
	}
	
	const value_type & get() const noexcept { return val; }
	static void set_mod(int M) noexcept { mod() = M; }
	static int get_mod() noexcept { return mod(); }
	
	friend std::ostream & operator <<(std::ostream & os, const RuntimeModInt & rhs) { return os << rhs.val; }
	friend std::istream & operator >>(std::istream & is, RuntimeModInt & rhs) {
		value_type x;
		is >> x;
		rhs = RuntimeModInt(x);
		return is;
	}
private:
	value_type val;
	
	static int & mod() {
		static int M = 2;
		return M;
	}
};
using mint = RuntimeModInt;

template<typename T>
struct Combination {
public:
	using size_type = std::size_t;
	
	Combination(size_type sz = 1) : _fact(1, 1), _finv(1, 1), _inv(1, 1) { build(sz); }
	
	T fact(size_type k) { if (k >= T::get_mod()) return 0; build(k); return _fact[k]; }
	T finv(size_type k) { assert(k < T::get_mod()); build(k); return _finv[k]; }
	T inv(size_type k) { assert(k > 0 && k < T::get_mod()); build(k); return _inv[k]; }
	
	T operator ()(int n, int r) { return c(n, r); }
	T c(int n, int r) {
		if (r < 0 || n < r) return 0;
		return fact(n) * finv(r) * finv(n - r);
	}
	
private:
	std::vector<T> _fact, _finv, _inv;
	static constexpr size_type MAX_LIMIT = 50000000;
	
	void build(size_type k) {
		if (_fact.size() > k) return;
		assert(k < MAX_LIMIT);
		size_type sz = std::min({MAX_LIMIT, static_cast<size_type>(T::get_mod()), std::max(_fact.size() * 2, k + 1)});
		size_type presz = _fact.size();
		_fact.resize(sz);
		_finv.resize(sz);
		_inv.resize(sz);
		
		for (size_type i = presz; i < sz; ++i) _fact[i] = _fact[i - 1] * i;
		_finv[sz - 1] = T(_fact[sz - 1]).inverse();
		for (size_type i = sz - 1; i > presz; --i) {
			_finv[i - 1] = _finv[i] * i;
			_inv[i] = _fact[i - 1] * _finv[i];
		}
		_inv[presz] = _fact[presz - 1] * _finv[presz];
	}
};
using Comb = Combination<mint>;
Comb comb;


// expr / (x - d) を返す
template<typename T>
std::vector<T> div_by_linear(const std::vector<T> & expr, T d) {
	assert(expr.size() >= 2);
	using size_t = std::size_t;
	std::vector<T> res(expr.size() - 1);
	T r = 0;
	for (size_t i = expr.size() - 1; i > 0; --i) {
		res[i - 1] = r + expr[i];
		r = res[i - 1] * d;
	}
	r += expr[0];
	assert(r == 0);
	return res;
}

mint dp[3001][3001];

int main() {
	int p;
	cin >> p;
	mint::set_mod(p);
	vector<mint> a(p);
	REP(i, p) cin >> a[i];
	
	dp[0][0] = 0; // [0,i)で合計j個の積の総和
	REP(i, p) {
		dp[i + 1][1] += i;
		REP(j, i + 1) {
			dp[i + 1][j] += dp[i][j];
			dp[i + 1][j + 1] += dp[i][j] * i;
		}
	}
	vector<mint> expr(p + 1); // [i]x^i
	expr[p] = 1;
	REP(i, p) expr[i] = dp[p][p - i] * (p - i & 1 ? -1 : 1);
	
	vector<mint> ans(p, 0);
	REP(i, p) {
		// f(i) = 1, f(j(!=i)) = 0
		vector<mint> cur = div_by_linear(expr, mint(i));
		mint div = comb.finv(i);
		div *= comb.finv(p - 1 - i) * (p - 1 - i & 1 ? -1 : 1);
		REP(j, cur.size()) cur[j] *= div;
		
		if (a[i] == 0) continue;
		REP(j, p) ans[j] += cur[j];
	}
	
	REP(i, p) cout << ans[i] << (i + 1 == p ? '\n' : ' ');
	cout << endl;
	return 0;
}


Measured memory_bytes: 70784