#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

struct Mint {
  using M = Mint;
  static unsigned P;
  unsigned v;
  constexpr Mint() : v(0) {}
  constexpr Mint(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr Mint(unsigned v, int) : v(v) {}
  static unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool)*this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
unsigned Mint::P;

V<Mint> fact, ifact, inv, powB;
void init(int n, int B = 2) {
  fact.resize(n + 1);
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fact[i] = i * fact[i - 1];
  }
  ifact.resize(n + 1);
  ifact[n] = 1 / fact[n];
  for (int i = n; i > 0; --i) {
    ifact[i - 1] = i * ifact[i];
  }
  inv.resize(n + 1);
  inv[1] = 1;
  for (int i = 2; i <= n; ++i) {
    int q = Mint::p() / i;
    inv[i] = -q * inv[Mint::p() - i * q];
  }
  powB.resize(n + 1);
  powB[0] = 1;
  for (int i = 0; i < n; ++i) {
    powB[i + 1] = powB[i] * B;
  }
}
Mint comb(int n, int r) {
  if (r < 0 or r > n) return 0;
  return fact[n] * ifact[r] * ifact[n - r];
}

using R = double;
constexpr R pi = acos((R) -1);
using C = complex<R>;
C& operator*=(C& l, const C& r) {
  return l = {real(l) * real(r) - imag(l) * imag(r), real(l) * imag(r) + imag(l) * real(r)};
}
void fft(V<C>& a, bool inv = false) {
  int n = a.size();
  int j = 0;
  for (int i = 1; i < n; ++i) {
    int w = n >> 1;
    while (j >= w) j -= w, w >>= 1;
    j += w;
    if (i < j) swap(a[i], a[j]);
  }
  static VV<C> xi(30);
  for (int k = 0; 1 << k < n; ++k) if (xi[k].empty()) {
    xi[k].resize(1 << k);
    for (int i = 0; i < 1 << k; ++i) {
      xi[k][i] = polar<R>(1, i * pi / (1 << k));
    }
  }
  for (int k = 0; 1 << k < n; ++k) {
    const int w = 1 << k;
    for (int s = 0; s < n; s += 2 * w) {
      for (int i = s; i < s + w; ++i) {
        j = i + w;
        a[j] *= inv ? conj(xi[k][i - s]) : xi[k][i - s];
        tie(a[i], a[j]) = make_pair(a[i] + a[j], a[i] - a[j]);
      }
    }
  }
}
template<int K = 15> void multiply(V<Mint>& a, const V<Mint>& b) {
  if (a.empty() or b.empty()) {
    a = {};
    return;
  }
  int n = 1 << __lg(2 * (a.size() + b.size() - 1) - 1);
  V<C> f(n), g(n);
  for (int i = 0; i < n; ++i) {
    if (i < (int) a.size()) f[i].real(a[i].v & ~(~0 << K)), f[i].imag(a[i].v >> K);
    if (i < (int) b.size()) g[i].real(b[i].v & ~(~0 << K)), g[i].imag(b[i].v >> K);
  }
  fft(f), fft(g);
  V<C> Al(n), Au(n), Bl(n), Bu(n);
  for (int i = 0; i < n; ++i) {
    Al[i] = (f[i] + conj(f[-i & n - 1])) / C(2, 0);
    Au[i] = (f[i] - conj(f[-i & n - 1])) / C(0, 2);
    Bl[i] = (g[i] + conj(g[-i & n - 1])) / C(2, 0);
    Bu[i] = (g[i] - conj(g[-i & n - 1])) / C(0, 2);
  }
  for (int i = 0; i < n; ++i) {
    f[i] = Al[i] * Bl[i] + C(0, 1) * Al[i] * Bu[i];
    g[i] = Au[i] * Bl[i] + C(0, 1) * Au[i] * Bu[i];
  }
  fft(f, true), fft(g, true);
  a.resize(a.size() + b.size() - 1);
  for (int i = 0; i < (int) a.size(); ++i) {
    lint l = real(f[i]) / n + 0.5;
    lint m = (imag(f[i]) + real(g[i])) / n + 0.5;
    lint u = imag(g[i]) / n + 0.5;
    a[i] = l + m * Mint(1 << K) + u * Mint(1 << 2 * K);
  }
}
template<class T> struct Polynomial {
  using P = Polynomial;
  V<T> c;
  Polynomial(const V<T>& c) : c(c) { shrink(); }
  void shrink() { while (!c.empty() and !c.back()) c.pop_back(); }
  int size() const { return c.size(); }
  void resize(int n) { c.resize(n); }
  T at(int i) const { return 0 <= i and i < size() ? c[i] : 0; }
  const T& operator[](int i) const { return c[i]; }
  T& operator[](int i) { return c[i]; }
  P operator*(const P& r) const { return P(*this) *= r; }
  P operator*(const T& r) const { return P(*this) *= r; }
  P operator/(const P& r) const { return P(*this) /= r; }
  P operator%(const P& r) const { return P(*this) %= r; }
  P operator+(const P& r) const { return P(*this) += r; }
  P operator-(const P& r) const { return P(*this) -= r; }
  P& operator*=(const T& r) { for (auto&& e : c) e *= r; shrink(); return *this; }
  P& operator*=(const P& r) { multiply(c, r.c); return *this; }
  P& operator/=(const P& r) {
    if (size() < r.size()) return *this = {{}};
    int n = size() - r.size() + 1;
    *this = rev() * r.rev().inv(n);
    resize(n);
    reverse(begin(c), end(c));
    return *this;
  }
  P& operator%=(const P& r) {
    *this -= *this / r * r;
    shrink();
    return *this;
  }
  P& operator+=(const P& r) {
    if (r.size() > size()) c.resize(r.size());
    for (int i = 0; i < r.size(); ++i) c[i] += r[i];
    shrink();
    return *this;
  }
  P& operator-=(const P& r) {
    if (r.size() > size()) c.resize(r.size());
    for (int i = 0; i < r.size(); ++i) c[i] -= r[i];
    shrink();
    return *this;
  }
  P rev() const {
    P res = *this;
    reverse(begin(res.c), end(res.c));
    res.shrink();
    return res;
  }
  P inv(int n) const {
    if (n == 1) {
      assert(!c.empty() and c[0]);
      return {{1 / c[0]}};
    }
    P res = *this;
    res.resize(n);
    P i = res.inv(n + 1 >> 1);
    res = i * (T) 2 - i * i * res;
    res.resize(n);
    res.shrink();
    return res;
  }
  P pow(int n) const {
    P res({1}), a = *this;
    while (n) {
      if (n & 1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  P pow_mod(int n, const P& c) const {
    P res({1}), a = *this;
    while (n) {
      if (n & 1) (res *= a) %= c;
      (a *= a) %= c;
      n >>= 1;
    }
    return res;
  }
};
using P = Polynomial<Mint>;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int p; cin >> p;
  Mint::P = p;
  init(p - 1);

  // V<P> l(p, P({})), r(p, P({}));
  // l[0] = P({0, 1});
  // for (int i = 1; i < p; ++i) {
  //   auto v = l[i - 1].c;
  //   v.insert(begin(v), 0);
  //   l[i] = P(v) - l[i - 1] * i;
  // }
  // r[p - 1] = P({-(p - 1), 1});
  // for (int i = p - 2; i >= 0; --i) {
  //   auto v = r[i + 1].c;
  //   v.insert(begin(v), 0);
  //   r[i] = P(v) - r[i + 1] * i;
  // }
  // cerr << "ok" << '\n';

  P res({});
  for (int i = 0; i < p; ++i) {
    int a; cin >> a;
    // int a = 1;
    if (!a) continue;
    V<Mint> v(p);
    if (i) {
      v[1] = -inv[i];
      for (int j = 2; j < p; ++j) {
        v[j] = v[j - 1] * inv[i];
      }
      // curr[1] = inv[i];
      // for (int j = 2; j < p; ++j) {
      //   curr[j] = curr[j - 1] * inv[i];
      // }
    } else {
      v[0] = 1;
      v[p - 1] = -1;
      // curr[0] = 1;
      // curr[p - 1] = -1;
    }
    P curr(v);
    // P nc = (i ? l[i - 1] : P({1})) * (i + 1 < p ? r[i + 1] : P({1}));
    // nc *= ifact[i] * (p - 1 - i & 1 ? -1 : 1) * ifact[p - 1 - i];
    // P nc = (i ? l[i - 1] : P({1})) * (i + 1 < p ? r[i + 1] : P({1}));
    // cerr << "nc.c(" << nc.c.size() << ") = {"; for (const auto& e : nc.c) cerr << e << ", "; cerr << "} (l." << __LINE__ << ")\n";
    // cerr << "curr.c(" << curr.c.size() << ") = {"; for (const auto& e : curr.c) cerr << e << ", "; cerr << "} (l." << __LINE__ << ")\n";
    // curr *= ifact[i] * (p - 1 - i & 1 ? -1 : 1) * ifact[p - 1 - i];
    res += curr;
  }

  for (int i = 0; i < p; ++i) {
    cout << res.at(i) << " \n"[i == p - 1];
  }
}

Measured memory_bytes: 384