2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int X = 0;
  register char ch = 0;
  while (ch < 48 || ch > 57) ch = getchar();
  while (ch >= 48 && ch <= 57) X = X * 10 + (ch ^ 48), ch = getchar();
  return X;
}
int n;
unsigned long long _sav[20], mod = 1ull << 58;
struct CP {
  unsigned long long x[10];
  CP operator*(CP const &B) const {
    for (int i = 0; i < 19; i++) _sav[i] = 0;
    for (int i = 0; i < 10; i++)
      for (int j = 0; j < 10; j++) _sav[i + j] += x[i] * B.x[j];
    CP ret;
    for (int i = 0; i < 10; i++) ret.x[i] = _sav[i] + _sav[i + 10];
    return ret;
  }
  inline void clear() {
    for (int i = 0; i < 10; i++) x[i] = 0;
  }
} f[100500];
void DWT(CP *f) {
  CP s[10];
  for (int len = 1; len < n; len *= 10)
    for (int p = 0; p < n; p += len * 10)
      for (int i = p; i < p + len; i++) {
        for (int j = 0; j < 10; j++) {
          s[j].clear();
          for (int k = 0; k < 10; k++) {
            int buf = j * k % 10;
            for (int d = 0; d + buf < 10; d++)
              s[j].x[d + buf] += f[i + k * len].x[d];
            for (int d = 10 - buf; d < 10; d++)
              s[j].x[d + buf - 10] += f[i + k * len].x[d];
          }
        }
        for (int j = 0; j < 10; j++) f[i + j * len] = s[j];
      }
}
void IDWT(CP *f) {
  CP s[10];
  for (int len = 1; len < n; len *= 10)
    for (int p = 0; p < n; p += len * 10)
      for (int i = p; i < p + len; i++) {
        for (int j = 0; j < 10; j++) {
          s[j].clear();
          for (int k = 0; k < 10; k++) {
            int buf = (10 - j * k % 10) % 10;
            for (int d = 0; d + buf < 10; d++)
              s[j].x[d + buf] += f[i + k * len].x[d];
            for (int d = 10 - buf; d < 10; d++)
              s[j].x[d + buf - 10] += f[i + k * len].x[d];
          }
          for (int k = 0; k < 10; k++)
            s[j].x[k] = (s[j].x[k] >> 1) * 57646075230342349ull;
        }
        for (int j = 0; j < 10; j++) f[i + j * len] = s[j];
      }
}
void powCP(CP &a, int t) {
  CP buf = a, ans;
  ans.clear();
  ans.x[0] = 1;
  while (t) {
    if (t & 1) ans = ans * buf;
    buf = buf * buf;
    t >>= 1;
  }
  a = ans;
}
int m, lim;
int main() {
  scanf("%d", &m);
  for (int i = 0, sav; i < m; i++) {
    f[sav = read()].x[0]++;
    lim = max(lim, sav);
  }
  for (n = 10; n < lim; n *= 10)
    ;
  DWT(f);
  for (int i = 0; i < n; i++) powCP(f[i], m);
  IDWT(f);
  for (int i = 0; i < m; i++) {
    f[i].x[5] -= f[i].x[3];
    f[i].x[0] -= f[i].x[2] + f[i].x[5];
    printf("%llu\n", f[i].x[0] % mod);
  }
  return 0;
}
