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: import sys
  
  P = int(input())
  As = list(map(int, input().split()))
  rs = [0] * P
  mod = P
  sys.setrecursionlimit(pow(10, 8))
  
  
  def power(x, y):
      if y == 0:
          return 1
      elif y == 1:
          return x % mod
      elif y % 2 == 0:
          return power(x, y // 2) ** 2 % mod
      else:
          return power(x, (y - 1) // 2) ** 2 * x % mod
  
  
  def mul(a, b):
      return ((a % mod) * (b % mod)) % mod
  
  
  def div(a, b):
      return mul(a, power(b, mod - 2))
  
  
  def cmb(n, r):
      if r < 0 or r > n:
          return 0
      r = min(r, n - r)
      return g1[n] * g2[r] * g2[n - r] % mod
  
  
  NNN = 3000
  g1 = [1, 1]
  g2 = [1, 1]
  inverse = [0, 1]
  for i in range(2, NNN + 1):
      g1.append((g1[-1] * i) % mod)
      inverse.append((-inverse[mod % i] * (mod // i)) % mod)
      g2.append((g2[-1] * inverse[-1]) % mod)
  C = []
  for i in range(P):
      C.append(cmb(P - 1, i))
  
  
  for i in range(P):
      if not i % 100:
          print(i)
      if As[i]:
          rs[0] += 1
          tmp = 1
          for k in range(P):
              k = P - 1 - k
              rs[k] += (-1 + 2 * (k % 2)) * tmp * C[k]
              rs[k] %= mod
              tmp = tmp * i % mod
  print(*rs)
  
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"}]