2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
struct xint {
  unsigned long long a[5];
  xint() {
    for (int i = 0; i <= 4; ++i) a[i] = 0;
  }
};
xint operator+(xint a, xint b) {
  for (int i = 0; i <= 4; ++i) a.a[i] += b.a[i];
  return a;
}
xint operator-(xint a, xint b) {
  for (int i = 0; i <= 4; ++i) a.a[i] -= b.a[i];
  return a;
}
xint operator*(xint a, xint b) {
  static int sa[6], sb[6];
  sa[0] = sb[0] = 0;
  for (int i = 0; i <= 4; ++i)
    if (a.a[i]) sa[++sa[0]] = i;
  for (int i = 0; i <= 4; ++i)
    if (b.a[i]) sb[++sb[0]] = i;
  xint c;
  for (int I = 1; I <= sa[0]; ++I)
    for (int J = 1; J <= sb[0]; ++J) {
      int i = sa[I], j = sb[J];
      (i + j < 5) ? (c.a[i + j] += a.a[i] * b.a[j])
                  : (c.a[i + j - 5] -= a.a[i] * b.a[j]);
    }
  return c;
}
xint getwn(int n) {
  xint c;
  n = (n % 10 + 10) % 10;
  (n < 5) ? (c.a[n]++) : (c.a[n - 5]--);
  return c;
}
void adjust(xint& s) {
  int p = s.a[1];
  for (int i = 0; i <= 4; ++i) (i & 1) ? s.a[i] -= p : s.a[i] += p;
}
unsigned long long mi(unsigned long long a, unsigned long long b) {
  unsigned long long s = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) s = s * a;
  return s;
}
xint mi(xint a, unsigned long long b) {
  xint s;
  s.a[0] = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) s = s * a;
  return s;
}
const int N = 100000;
int n, x[N + 1];
xint a[N], b[N][10], r[N];
void dft(xint* a, int L) {
  for (int i = 0; i <= N - 1; ++i)
    for (int j = 0; j <= 4; ++j) r[i].a[j] = 0;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j <= 9; ++j) b[i][j] = a[i] * getwn(j);
  for (int i = 0; i < N; i += L * 10)
    for (int j = 0; j < 10; ++j)
      for (int k = 0; k < 10; ++k) {
        int wn = j * k % 10, lk = i + L * k, lj = i + L * j;
        for (int I = 0; I < L; ++I) r[lj + I] = r[lj + I] + b[lk + I][wn];
      }
  for (int i = 0; i <= N - 1; ++i) a[i] = r[i];
}
void idft(xint* a, int L) {
  for (int i = 0; i <= N - 1; ++i)
    for (int j = 0; j <= 4; ++j) r[i].a[j] = 0;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j <= 9; ++j) b[i][j] = a[i] * getwn(j);
  for (int i = 0; i < N; i += L * 10)
    for (int j = 0; j < 10; ++j)
      for (int k = 0; k < 10; ++k) {
        int wn = (10 - j * k % 10) % 10, lk = i + L * k, lj = i + L * j;
        for (int I = 0; I < L; ++I) r[lj + I] = r[lj + I] + b[lk + I][wn];
      }
  for (int i = 0; i <= N - 1; ++i) a[i] = r[i];
}
int main() {
  unsigned long long w = mi(3125, (1LL << 57) - 1);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> x[i];
  for (int i = 1; i <= n; ++i) a[x[i]].a[0]++;
  for (int i = 1; i < N; i *= 10) dft(a, i);
  for (int i = 0; i <= N - 1; ++i) a[i] = mi(a[i], n);
  for (int i = N / 10; i >= 1; i /= 10) idft(a, i);
  for (int i = 0; i <= N - 1; ++i) adjust(a[i]);
  for (int i = 0; i <= N - 1; ++i)
    a[i].a[0] /= 32, a[i].a[0] *= w, a[i].a[0] &= ((1LL << 58) - 1);
  for (int i = 0; i <= n - 1; ++i) cout << a[i].a[0] << endl;
}
