#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cassert>
using namespace std;
using i64 = int64_t;
i64 mod;
struct Fp {
    i64 x;
    Fp (i64 x = 0) : x(x % mod) {}
    i64 value() const {
        return x;
    }
    Fp operator-() const {
        return Fp(mod - x);
    }
    template<class T>
    Fp pow(T k) const {
        Fp res = Fp(1), b = *this;
        for (; k > 0; k >>= 1) {
            if (k & 1) res *= b;
            b *= b;
        }
        return res;
    }
    Fp inv() const {
        return pow(mod - 2);
    }
    Fp& operator+=(Fp rhs) {
        x += rhs.x;
        if (x >= mod) x -= mod;
        return *this;
    }
    Fp& operator-=(Fp rhs) {
        *this += -rhs;
        return *this;
    }
    Fp& operator*=(Fp rhs) {
        (x *= rhs.x) %= mod;
        return *this;
    }
    Fp& operator/=(Fp rhs) {
        *this *= rhs.inv();
        return *this;
    }
};
Fp operator+(Fp lhs, Fp rhs) {
    return lhs += rhs;
}
Fp operator-(Fp lhs, Fp rhs) {
    return lhs -= rhs;
}
Fp operator*(Fp lhs, Fp rhs) {
    return lhs *= rhs;
}
Fp operator/(Fp lhs, Fp rhs) {
    return lhs /= rhs;
}
bool operator==(Fp lhs, Fp rhs) {
    return lhs.x == rhs.x;
}
template<class T>
struct LagrangeInterpolation {
    vector<T> xs, ys, ws;
    LagrangeInterpolation() {}
    template<class A, class B>
    LagrangeInterpolation(const A& xs_, const B& ys_) {
        for (int i = 0; i < xs_.size(); ++i) {
            add(xs_[i], ys_[i]);
        }
    }
    void add(T x, T y) {
        xs.push_back(x);
        ys.push_back(y);
        ws.push_back(T(1));
        int j = size() - 1;
        for (int i = 0; i < j; ++i) {
            ws[i] *= xs[i] - x;
            ws[j] *= x - xs[i];
        }
    }
    T operator()(T x) const {
        T p = T(1);
        for (int i = 0; i < size(); ++i) {
            if (x == xs[i]) {
                return ys[i];
            }
            p *= x - xs[i];
        }
        T l = T(0);
        for (int i = 0; i < size(); ++i) {
            l += ys[i] / (ws[i] * (x - xs[i]));
        }
        return p * l;
    }
    size_t size() const {
        return xs.size();
    }
    vector<T> expand() const {
        int n = size();
        vector<T> l(n + 1);
        l[n] = T(1);
        for (int i = 0; i < n; ++i) {
            for (int j = n - i; j <= n; ++j) {
                l[j - 1] -= xs[i] * l[j];
            }
        }
        vector<T> res(n);
        vector<T> q(n);
        q[n - 1] = T(1);
        // q[n-1]x^(n-1) + q[n-2]x^(n-2) + ...
        // = (l[n]x^n + l[n]x^(n-1) + ...) / (x + (-xs[i]))
        for (int i = 0; i < n; ++i) {
            for (int j = n - 1; j > 0; --j) {
                q[j - 1] = l[j] + xs[i] * q[j];
            }
            T k = ys[i] / ws[i];
            for (int j = 0; j <= n - 1; ++j) {
                res[j] += k * q[j];
            }
        }
        return res;
    }
};
int main() {
    i64 p;
    cin >> p;
    mod = p;
    LagrangeInterpolation<Fp> li;
    for (int i = 0; i < p; ++i) {
        i64 y;
        cin >> y;
        li.add(Fp(i), Fp(y));
    }
    auto bs = li.expand();
    for (int i = 0; i < p; ++i) {
        cout << bs[i].value() << ' ';
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512