#include "bits/stdc++.h"
using namespace std;
typedef long long li;

li mod = 0;

li pow(li x, li n) {
    if (n == 0) {
        return 1;
    }
    if (n == 1) {
        return x;
    }

    li sq = pow(x, n / 2);
    if (n & 1) {
        return sq * sq % mod * x % mod;
    }
    return sq * sq % mod;
}

li inv(li x) {
    return pow(x, mod - 2);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    li p;
    cin >> p;
    mod = p;

    vector<li> xs(p);
    for (int i = 0; i < p; ++i) {
        cin >> xs[i];
    }

    vector<li> ys(p);
    for (int i = 0; i < p; ++i) {
        vector<li> poly(p + 1);
        poly[p] = 1;
        poly[1] = (p - 1);

        vector<li> div(p + 1);

        for (int d = p; d >= 1; --d) {
            li c = (p - poly[d]) % p * i % p;
            div[d - 1] = poly[d];
            poly[d] = 0;
            poly[d - 1] = (poly[d - 1] + p - c) % p;
        }

        for (int j = 0; j < p; ++j) {
            ys[j] = (ys[j] + div[j] * xs[i] % p * (p - 1) % p) % p;
        }
    }

    for (int i = 0; i < p; ++i) {
        cout << ys[i];
        if (i == p - 1) {
            cout << endl;
        } else {
            cout << " ";
        }
    }
    return 0;
}