2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
array<unsigned long long, 5> operator+(const array<unsigned long long, 5> &A,
                                       const array<unsigned long long, 5> &B) {
  array<unsigned long long, 5> ret;
  for (int i = 0; i < 5; i++) ret[i] = A[i] + B[i];
  return ret;
}
array<unsigned long long, 5> operator-(const array<unsigned long long, 5> &A,
                                       const array<unsigned long long, 5> &B) {
  array<unsigned long long, 5> ret;
  for (int i = 0; i < 5; i++) ret[i] = A[i] - B[i];
  return ret;
}
array<unsigned long long, 5> operator*(const array<unsigned long long, 5> &A,
                                       const unsigned long long &B) {
  array<unsigned long long, 5> ret;
  for (int i = 0; i < 5; i++) ret[i] = A[i] * B;
  return ret;
}
array<unsigned long long, 5> operator*(const array<unsigned long long, 5> &A,
                                       const array<unsigned long long, 5> &B) {
  array<unsigned long long, 9> tmp;
  fill(tmp.begin(), tmp.end(), 0);
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++) tmp[i + j] += A[i] * B[j];
  for (int i = 3; i >= 0; i--) tmp[i] += tmp[i + 5];
  array<unsigned long long, 5> ret;
  for (int i = 0; i <= 4; i++) ret[i] = tmp[i];
  return ret;
}
const unsigned long long inv5 = 14757395258967641293;
inline array<unsigned long long, 5> power(array<unsigned long long, 5> A,
                                          int b) {
  array<unsigned long long, 5> ret;
  ret[0] = 1;
  ret[1] = ret[2] = ret[3] = ret[4] = 0;
  while (b) {
    if (b & 1) ret = ret * A;
    A = A * A;
    b >>= 1;
  }
  return ret;
}
int n;
array<unsigned long long, 5> A[100010];
const unsigned long long pw[] = {1, 10, 100, 1000, 10000, 100000};
array<unsigned long long, 5> w10[15];
void init() {
  w10[0][0] = 1;
  w10[1][3] = -1;
  for (int i = 2; i < 10; i++) w10[i] = w10[i - 1] * w10[1];
}
void dft(array<unsigned long long, 5> *A, int flag, int len) {
  for (int d = 0; d < 5; d++) {
    for (int i = 0; i < len; i++) {
      if ((i / pw[d]) % 10 == 0) {
        array<unsigned long long, 5> b[10];
        for (int j = 0; j < 10; j++) fill(b[j].begin(), b[j].end(), 0);
        for (int j = 0; j < 10; j++) {
          for (int k = 0; k < 10; k++) {
            b[j] =
                b[j] + A[i + k * pw[d]] * w10[((flag * j * k) % 10 + 10) % 10];
          }
        }
        for (int j = 0; j < 10; j++) A[i + j * pw[d]] = b[j];
      }
    }
  }
  if (flag == -1) {
    unsigned long long iv = inv5 * inv5 * inv5 * inv5 * inv5;
    for (int i = 0; i < len; i++) A[i] = A[i] * iv;
  }
}
int main() {
  init();
  scanf("%d", &n);
  for (int i = 1, a; i <= n; i++) {
    scanf("%d", &a);
    A[a][0]++;
  }
  dft(A, 1, 100000);
  for (int i = 0; i < 100000; i++) A[i] = power(A[i], n);
  dft(A, -1, 100000);
  for (int i = 0; i < n; i++)
    printf("%llu\n", ((A[i][0] - A[i][4]) / 32) % (1ull << 58));
  return 0;
}
