2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
inline long long Getint() {
  char ch = getchar();
  long long x = 0, fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    (x *= 10) += ch ^ 48;
    ch = getchar();
  }
  return x * fh;
}
const unsigned long long mod = 1ull << 58;
const int N = 100005, lim = 5;
struct nod {
  unsigned long long a[lim];
  nod() { memset(a, 0, sizeof(a)); }
  nod(unsigned long long x) {
    memset(a, 0, sizeof(a));
    a[0] = x;
  }
  inline unsigned long long &operator[](const int &p) { return a[p]; }
  inline const unsigned long long &operator[](const int &p) const {
    return a[p];
  }
  inline nod operator+(const nod &p) const {
    nod t;
    for (int i = 0; i <= lim - 1; i++) t[i] = a[i] + p[i];
    return t;
  }
  inline nod operator-(const nod &p) const {
    nod t;
    for (int i = 0; i <= lim - 1; i++) t[i] = a[i] - p[i];
    return t;
  }
  inline nod operator+(const unsigned long long &p) const {
    nod t;
    for (int i = 0; i <= lim - 1; i++) t[i] = a[i];
    t[0] += p;
    return t;
  }
  inline nod operator-(const unsigned long long &p) const {
    nod t;
    for (int i = 0; i <= lim - 1; i++) t[i] = a[i];
    t[0] -= p;
    return t;
  }
  inline void operator+=(const unsigned long long &p) { a[0] += p; }
  inline void operator-=(const unsigned long long &p) { a[0] -= p; }
  inline nod operator*(const unsigned long long &p) const {
    nod t;
    for (int i = 0; i <= lim - 1; i++) t[i] = a[i] * p;
    return t;
  }
  inline nod operator*(const nod &p) const {
    nod t;
    for (int i = 0; i <= lim - 1; i++)
      for (int j = 0; j <= lim - 1; j++) {
        if (i + j <= 4)
          t[i + j] += a[i] * p[j];
        else
          t[i + j - 5] -= a[i] * p[j];
      }
    return t;
  }
};
int n;
unsigned long long a[N], pw[15];
inline long long Exgcd(long long p, long long q, long long &x, long long &y) {
  if (q == 0) {
    x = 1;
    y = 0;
    return p;
  }
  long long d = Exgcd(q, p % q, y, x);
  y -= p / q * x;
  return d;
}
inline unsigned long long Inv(unsigned long long x) {
  long long lx, ly;
  Exgcd(x, mod, lx, ly);
  return lx & (mod - 1);
}
inline unsigned long long Ksm(unsigned long long x, long long y) {
  unsigned long long tmp = 1;
  while (y) {
    if (y & 1) tmp = tmp * x;
    y >>= 1;
    if (y) x = x * x;
  }
  return tmp & (mod - 1);
}
inline nod Ksm(nod x, long long y) {
  nod tmp(1);
  while (y) {
    if (y & 1) tmp = tmp * x;
    y >>= 1;
    if (y) x = x * x;
  }
  return tmp;
}
nod pwi[2][15][15];
void FWT(vector<nod> &F, int len, int f) {
  for (int i = 1; i < len; i *= 10) {
    for (int j = 0; j < len; j += i * 10) {
      for (int k = 0; k < i; k++) {
        nod c[10];
        for (int t = 0; t < 10; t++) c[t] = F[t * i + j + k];
        for (int t = 0; t < 10; t++) {
          nod tmp;
          for (int p = 0; p < 10; p++)
            tmp = tmp + c[p] * pwi[f == 1 ? 0 : 1][t][p];
          F[t * i + j + k] = tmp;
        }
      }
    }
  }
  if (f == 1) return;
  for (int i = 0; i <= len - 1; i++) {
    F[i][0] -= F[i][2];
    for (int j = 1; j <= lim - 1; j++) F[i][j] = 0;
  }
  for (int i = 0; i <= len - 1; i++) (F[i][0] >>= 1) &= mod - 1;
  unsigned long long iv = Ksm(Inv(5), 1);
  for (int i = 0; i <= len - 1; i++) F[i][0] = (F[i][0] * iv) & (mod - 1);
}
int main() {
  unsigned long long x, y, z;
  pw[0] = 1;
  for (int i = 1; i <= 10; i++) pw[i] = pw[i - 1] * 10;
  for (int i = 0; i <= 9; i++) {
    pwi[0][i][0] = pwi[1][i][0] = nod(1);
    int j = (10 - i) % 10;
    if (i <= 4)
      pwi[0][i][1][i] += 1;
    else
      pwi[0][i][1][i - 5] -= 1;
    if (j <= 4)
      pwi[1][i][1][j] += 1;
    else
      pwi[1][i][1][j - 5] -= 1;
    for (int j = 2; j <= 9; j++) {
      pwi[0][i][j] = pwi[0][i][j - 1] * pwi[0][i][1];
      pwi[1][i][j] = pwi[1][i][j - 1] * pwi[1][i][1];
    }
  }
  n = Getint();
  vector<nod> ans(pw[5]);
  for (int i = 1; i <= n; i++) x = Getint(), ans[x] += 1;
  FWT(ans, pw[5], 1);
  for (int i = 0; i <= pw[1] - 1; i++) ans[i] = Ksm(ans[i], n);
  FWT(ans, pw[1], -1);
  for (int i = 0; i <= n - 1; i++) cout << ans[i][0] << '\n';
  return 0;
}
