#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = 1ull << 58;
const unsigned long long inv5 = 6723469279985657373ull;
const int maxn = 100005;
int n;
struct num {
  unsigned long long a[5];
  num() { memset(a, 0, sizeof(a)); }
  friend num operator+(num A, num B) {
    for (int i = 0; i < 5; i++) A.a[i] += B.a[i];
    return A;
  }
  friend num operator*(num A, num B) {
    num C;
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 5; j++) C.a[(i + j) % 5] += A.a[i] * B.a[j];
    return C;
  }
  num shift(int x) {
    num C;
    for (int i = 0; i < 5; i++) C.a[(i + x) % 5] = (x & 1) ? -a[i] : a[i];
    return C;
  }
};
num quick_pow(num x, int y) {
  if (y == 1) return x;
  num res = x;
  y--;
  while (y) {
    if (y & 1) res = res * x;
    x = x * x, y >>= 1;
  }
  return res;
}
void fft(num *A, int N, int opt) {
  for (int l = 1; l < N; l *= 10)
    for (int now = 0; now < N; now++)
      if ((now / l) % 10 == 0) {
        num owo[10];
        for (int i = 0; i < 10; i++)
          for (int j = 0; j < 10; j++)
            owo[i] = owo[i] + A[now + j * l].shift(i * j * (10 + opt) % 10);
        for (int i = 0; i < 10; i++) A[now + i * l] = owo[i];
      }
}
num A[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) scanf("%d", &x), A[x].a[0]++;
  int N = 100000;
  fft(A, N, 1);
  for (int i = 0; i < N; i++) A[i] = quick_pow(A[i], n);
  fft(A, N, -1);
  for (int i = 0; i < n; i++)
    printf("%llu\n", (A[i].a[0] - A[i].a[4]) * inv5 / 32 % mod);
  return 0;
}
