output_description: Print b_0, b_1, \ldots, b_{p-1} of a polynomial f(x) satisfying the
  conditions, in this order, with spaces in between.
  
  It can be proved that a solution always exists. If multiple solutions exist,
  any of them will be accepted.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      p
      a_0 a_1 \ldots a_{p-1}
attempt: def modinv(x, mod):
      a, b = x, mod
      u, v = 1, 0
      while b:
          t = a // b
          a -= t * b
          a, b = b, a
          u -= t * v
          u, v = v, u
      return u % mod
  
  
  def Lagrange_interpolation(X, Y, mod):  # O(N**2)
      n = len(X) - 1
      for i in range(n + 1):
          t = 1
          for j in range(n + 1):
              if i != j:
                  t = t * (X[i] - X[j]) % mod
          Y[i] = Y[i] * modinv(t, mod) % mod
  
          cur, nxt = 0, 1
          dp = [[0] * (n + 2) for _ in range(2)]
          dp[0][0], dp[0][1] = -X[0], 1
          for i in range(1, n + 1):
              for j in range(n + 2):
                  dp[nxt][j] = dp[cur][j] * -X[i] % mod
                  if j:
                      dp[nxt][j] = (dp[nxt][j] + dp[cur][j - 1]) % mod
              cur, nxt = nxt, cur
          xinv = [modinv(v, mod) for v in X]
          ret = [0] * (n + 1)
          for i in range(n + 1):
              if Y[i] == 0:
                  continue  # 0割り対策
              if X[i] == 0:
                  for j in range(n + 1):
                      ret[j] = (ret[j] + dp[cur][j + 1] * Y[i]) % mod
              else:
                  ret[0] = (ret[0] - dp[cur][0] * xinv[i] * Y[i]) % mod
                  pre = -dp[cur][0] * xinv[i] % mod
                  for j in range(1, n + 1):
                      ret[j] = (ret[j] - (dp[cur][j] - pre) * xinv[i] * Y[i]) % mod
                      pre = (pre - dp[cur][j]) * xinv[i] % mod
          return ret
  
  
  p = int(input())
  a = list(map(int, input().split()))
  x = list(range(p))
  res = Lagrange_interpolation(x, a, p)
  print(*res)
  
problem_description: Statement
  
  Given are a prime number p and a sequence of p integers a_0, \ldots, a_{p-1}
  consisting of zeros and ones.
  
  Find a polynomial of degree at most p-1, f(x) = b_{p-1} x^{p-1} + b_{p-2}
  x^{p-2} + \ldots + b_0, satisfying the following conditions:
  
    * For each i (0 \leq i \leq p-1), b_i is an integer such that 0 \leq b_i \leq p-1.
    * For each i (0 \leq i \leq p-1), f(i) \equiv a_i \pmod p.
samples: [{"input": "2\n    1 0", "output": "1 1\n    \n\nf(x) = x + 1 satisfies the conditions, as follows:\n\n  * f(0) = 0 + 1 = 1 \\equiv 1 \\pmod 2\n  * f(1) = 1 + 1 = 2 \\equiv 0 \\pmod 2\n\n* * *"}, {"input": "3\n    0 0 0", "output": "0 0 0\n    \n\nf(x) = 0 is also valid.\n\n* * *"}, {"input": "5\n    0 1 0 1 0", "output": "0 2 0 1 3"}]