2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
inline int read() {
  int data = 0, w = 1;
  char ch = getchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') w = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
  return data * w;
}
using ull = unsigned long long;
const int N(1e5 + 10);
const ull inv5(14757395258967641293ull), Mod((1ull << 58ull) - 1);
struct Int {
  ull w[10];
  ull eval() { return w[0] - w[4] - w[5] + w[9]; }
} p[N];
Int operator+(const Int &a, const Int &b) {
  Int c;
  for (int i = 0; i < 10; i++) c.w[i] = a.w[i] + b.w[i];
  return c;
}
Int Mul(const Int &a, int k, ull o) {
  Int b;
  for (int i = 0; i < 10; i++) b.w[(i + k) % 10] = a.w[i] * o;
  return b;
}
Int operator*(const Int &a, const Int &b) {
  Int c;
  std::memset(c.w, 0, sizeof c.w);
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) c.w[(i + j) % 10] += a.w[i] * b.w[j];
  return c;
}
Int fastpow(Int x, int y) {
  Int ans;
  std::memset(ans.w, 0, sizeof ans.w), ans.w[0] = 1;
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ans = ans * x;
  return ans;
}
ull invL, P;
int n, m, L, a[N];
void DFT(Int *p, int o) {
  for (int i = 1; i < L; i *= 10)
    for (int j = 0; j < L; j += i * 10)
      for (int k = 0; k < i; k++) {
        static Int t[10];
        std::memset(t, 0, sizeof t);
        for (int u = 0; u < 10; u++)
          for (int v = 0; v < 10; v++) {
            int w = (o * u * v % 10 + 10) % 10;
            if (w < 5)
              t[v] = t[v] + Mul(p[i * u + j + k], w, 1);
            else
              t[v] = t[v] + Mul(p[i * u + j + k], w - 5, -1);
          }
        for (int u = 0; u < 10; u++) p[i * u + j + k] = t[u];
      }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read(), p[a[i]].w[0]++;
  m = *std::max_element(a + 1, a + n + 1);
  for (invL = L = 1; L <= m; L *= 10, invL *= inv5, ++P)
    ;
  DFT(p, 1);
  for (int i = 0; i < L; i++) p[i] = fastpow(p[i], n);
  DFT(p, -1);
  for (int i = 0; i < n; i++)
    printf("%llu\n", ((p[i].eval() * invL) >> P) & Mod);
  return 0;
}
