#include <iostream>
#include <vector>

int main() {
    int p;
    std::cin >> p;

    std::vector<int> a(p);
    for (int i = 0; i < p; i++) std::cin >> a[i];

    auto pow = [&p](long long a, int n) {
        long long res = 1;
        for (; n; n >>= 1) {
            if (n & 1) res = res * a % p;
            a = a * a % p;
        }
        return res;
    };

    std::vector<long long> fact(p), inv_fact(p);
    fact[0] = 1;
    for (int i = 1; i < p; i++)
        fact[i] = fact[i - 1] * i % p;
    inv_fact[p - 1] = pow(fact[p - 1], p - 2);
    for (int i = p - 1; i > 0; i--)
        inv_fact[i - 1] = inv_fact[i] * i % p;

    auto comb = [&p, &fact, &inv_fact](int n, int r) {
        if (n < r) return 0LL;
        long long tmp = inv_fact[n - r] * inv_fact[r] % p;
        return fact[n] * tmp % p;
    };

    std::vector<int> b(p);
    for (int i = 0; i < p; i++) {
        if (a[i] == 0) continue;

        std::vector<int> c(p);
        c[p - 1] = 1;
        for (int k = p - 2; k >= 0; k--)
            c[k] = -i * c[k + 1] % p;

        b[0]++;
        for (int k = 0; k < p; k++)
            b[k] = (b[k] + p - comb(p - 1, k) * c[k] % p) % p;
    }

    for (int i = 0; i < p; i++)
        std::cout << b[i] << (i < p - 1 ? " " : "\n");
}