2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
struct Cp {
  unsigned long long a[5];
  Cp() { fill(a, a + 5, 0); }
} w[100], A[N], B[N];
Cp operator+(Cp a, const Cp &b) {
  for (int j = 0; j != 5; ++j) a.a[j] += b.a[j];
  return a;
}
Cp operator-(Cp a, const Cp &b) {
  for (int j = 0; j != 5; ++j) a.a[j] -= b.a[j];
  return a;
}
Cp operator*(Cp a, const unsigned long long &b) {
  for (int j = 0; j != 5; ++j) a.a[j] *= b;
  return a;
}
Cp operator*(Cp a, const Cp &b) {
  static unsigned long long c[10];
  fill(c, c + 10, 0);
  for (int j = 0; j != 5; ++j)
    for (int k = 0; k != 5; ++k) c[j + k] += a.a[j] * b.a[k];
  for (int j = 0; j != 5; ++j) a.a[j] = c[j] + c[j + 5];
  return a;
}
Cp fexp(Cp a, unsigned long long b) {
  Cp x;
  x.a[0] = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) x = x * a;
  return x;
}
void init() {
  w[0].a[0] = 1;
  w[1].a[3] = -1;
  for (int i = 2; i < 100; ++i) w[i] = w[i - 1] * w[1];
}
void DWT(Cp *a) {
  static Cp t[10];
  for (int d = 1; d < N; d *= 10)
    for (int i = 0; i < N; i += d * 10)
      for (int j = 0; j < d; ++j) {
        for (int k = 0; k < 10; ++k) {
          t[k] = Cp();
          for (int p = 0; p < 10; ++p)
            t[k] = t[k] + a[i + j + p * d] * w[p * k];
        }
        for (int k = 0; k < 10; ++k) a[i + j + k * d] = t[k];
      }
}
void IDWT(Cp *a) {
  static Cp t[10];
  for (int d = 1; d < N; d *= 10)
    for (int i = 0; i < N; i += d * 10)
      for (int j = 0; j < d; ++j) {
        for (int k = 0; k < 10; ++k) {
          t[k] = Cp();
          for (int p = 0; p < 10; ++p)
            t[k] = t[k] + a[i + j + p * d] * w[p * k];
        }
        reverse(t + 1, t + 10);
        for (int k = 0; k < 10; ++k)
          a[i + j + k * d] = t[k] * 14757395258967641293ULL;
      }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int x, i = 0; i < n; ++i) {
    scanf("%d", &x);
    ++A[x].a[0];
  }
  init();
  DWT(A);
  for (int s = 0; s != N; ++s) A[s] = fexp(A[s], n);
  IDWT(A);
  for (int s = 0; s < n; ++s)
    printf("%llu\n", ((A[s].a[0] - A[s].a[1]) >> 5) & ((1ULL << 58) - 1));
  return 0;
}
