#include <iostream>
using namespace std;

long long p;
long long a[3000], s[3000], t[3000], b[3000];

int main()
{
	cin >> p;

	for (long long i = 0; i < p; i++)
		cin >> a[i];

	for (long long i = 0; i < p; i++)
		b[i] = 0;

	s[0] = 1;
	t[0] = 1;

	for (long long i = 1; i < p; i++) {
		s[i] = s[i - 1] * i % p;

		long long j = s[i], k = 1;

		while (k < (p - 2) / 2) {
			j = j * j % p;
			k *= 2;
		}

		while (k < p - 2) {
			j = j * s[i] % p;
			k++;
		}

		t[i] = j;
	}

	for (long long i = 0; i < p; i++) {
		if (a[i] == 1) {
			b[p - 1] = (b[p - 1] - 1 + p) % p;

			if (i == 0)
				b[0] = (b[0] + 1) % p;
			else {
				long long u = i, v = 1;

				while (v < (p - 2) / 2) {
					u = u * u % p;
					v *= 2;
				}

				while (v < p - 2) {
					u = u * i % p;
					v++;
				}

				long long w = u;

				for (long long j = 1; j < p - 1; j++) {
					if (j % 2 == 0)
						b[j] = (b[j] - s[p - 1] * t[j] % p * t[p - 1 - j] % p * w + p) % p;
					else
						b[j] = (b[j] + s[p - 1] * t[j] % p * t[p - 1 - j] % p * w) % p;

					w = w * u % p;
				}
			}
		}
	}

	for (long long i = 0; i < p - 1; i++)
		cout << b[i] << " ";
	cout << b[p - 1] << endl;

	return 0;
}