2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
const int D = 10;
struct num {
  unsigned long long a[D];
  inline num() { memset(a, 0, sizeof(a)); }
  inline num sh(int k) {
    num p;
    k = (k % D + D) % D;
    for (int i = 0; i < D; i++)
      p.a[((i + k) >= D) ? (i + k - D) : (i + k)] = a[i];
    return p;
  }
  inline num operator+(const num &y) const {
    num p;
    for (int i = 0; i < D; i++) p.a[i] = a[i] + y.a[i];
    return p;
  }
  inline num operator*(const num &y) const {
    int i, j;
    num p;
    for (i = 0; i < D; i++)
      for (j = 0; j < D; j++)
        p.a[(i + j >= D) ? (i + j - D) : (i + j)] += a[i] * y.a[j];
    return p;
  }
} nul, a[1000127];
int m, n;
unsigned long long inv5 = 57646075230342349ull;
inline void FDWT(num f[], int len) {
  int i, j, k, w, w1;
  num g[D], p;
  for (i = 1; i < len; i *= D)
    for (j = 0; j < len; j += i * D)
      for (k = 0; k < i; k++) {
        for (w = 0; w < D; w++) {
          for (p = nul, w1 = 0; w1 < D; w1++)
            p = p + f[j + k + w1 * i].sh(w * w1);
          g[w] = p;
        }
        for (w = 0; w < D; w++) f[j + k + w * i] = g[w];
      }
}
inline void IFDWT(num f[], int len) {
  int i, j, k, w, w1;
  num g[D], p;
  for (i = 1; i < len; i *= D)
    for (j = 0; j < len; j += i * D)
      for (k = 0; k < i; k++) {
        for (w = 0; w < D; w++) {
          for (p = nul, w1 = 0; w1 < D; w1++)
            p = p + f[j + k + w1 * i].sh(-w * w1);
          for (w1 = 0; w1 < D; w1++) p.a[w1] = (p.a[w1] >> 1) * inv5;
          g[w] = p;
        }
        for (w = 0; w < D; w++) f[j + k + w * i] = g[w];
      }
}
inline num ksm(num p, int k) {
  num res;
  res.a[0] = 1;
  while (k) {
    if (k & 1) res = res * p;
    p = p * p;
    k >>= 1;
  }
  return res;
}
int main() {
  scanf("%d", &m);
  int i, x, len = 0;
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    ++a[x].a[0];
    n = max(n, x);
  }
  len = 1;
  while (len <= n) len *= D;
  FDWT(a, len);
  for (i = 0; i < len; i++) a[i] = ksm(a[i], m);
  IFDWT(a, len);
  for (i = 0; i < m; i++)
    printf("%llu\n", (a[i].a[0] - a[i].a[2] + a[i].a[3] - a[i].a[5]) %
                         288230376151711744ull);
  return 0;
}
