2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
const unsigned long long inv5 = 14757395258967641293ull, mod = 1ll << 58,
                         inv = inv5 * inv5 * inv5 * inv5 * inv5;
int n, x;
struct cp {
  unsigned long long a[5];
  cp() { a[0] = a[1] = a[2] = a[3] = a[4] = 0; }
  inline unsigned long long &operator[](int x) { return a[x]; }
  void print() {
    for (int i = (0); i <= (4); ++i) printf("%llu ", a[i]);
    puts("");
  }
} w[11], a[100010], b[10];
inline cp operator+(cp a, cp b) {
  for (int i = (0); i <= (4); ++i) a[i] += b[i];
  return a;
}
inline cp operator-(cp a, cp b) {
  for (int i = (0); i <= (4); ++i) a[i] -= b[i];
  return a;
}
inline cp operator*(cp a, unsigned long long b) {
  for (int i = (0); i <= (4); ++i) a[i] *= b;
  return a;
}
inline cp operator*(cp a, cp b) {
  unsigned long long c[10];
  memset(c, 0, sizeof(c));
  for (int i = (0); i <= (4); ++i)
    for (int j = (0); j <= (4); ++j) c[i + j] += a[i] * b[j];
  for (int i = (0); i <= (4); ++i) a[i] = c[i] + c[i + 5];
  return a;
}
cp ksm(cp a, int b) {
  cp ans;
  ans[0] = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) ans = ans * a;
  return ans;
}
int d[] = {1, 10, 100, 1000, 10000, 100000};
void init() {
  w[0][0] = 1;
  w[1][1] = -1;
  for (int i = (2); i <= (10); ++i) w[i] = w[i - 1] * w[1];
}
void dft(cp *a) {
  for (int p = (0); p <= (4); ++p)
    for (int i = (0); i <= (99999); ++i)
      if (i / d[p] % 10 == 0) {
        for (int j = (0); j <= (9); ++j) b[j] = cp();
        for (int j = (0); j <= (9); ++j)
          for (int k = (0); k <= (9); ++k)
            b[j] = b[j] + a[i + k * d[p]] * w[j * k % 10];
        for (int j = (0); j <= (9); ++j) a[i + j * d[p]] = b[j];
      }
}
void idft(cp *a) {
  for (int p = (0); p <= (4); ++p)
    for (int i = (0); i <= (99999); ++i)
      if (i / d[p] % 10 == 0) {
        for (int j = (0); j <= (9); ++j) b[j] = cp();
        for (int j = (0); j <= (9); ++j)
          for (int k = (0); k <= (9); ++k)
            b[j] = b[j] + a[i + k * d[p]] * w[10 - j * k % 10];
        for (int j = (0); j <= (9); ++j) a[i + j * d[p]] = b[j];
      }
  for (int i = (0); i <= (99999); ++i) a[i] = a[i] * inv;
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i <= (n - 1); ++i) scanf("%d", &x), a[x][0]++;
  init();
  dft(a);
  for (int i = (0); i <= (99999); ++i) a[i] = ksm(a[i], n);
  idft(a);
  for (int i = (0); i <= (n - 1); ++i)
    printf("%llu\n", (a[i][0] - a[i][4]) / 32 % mod);
  return 0;
}
