2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using ULL = unsigned long long;
const int N = 100000;
const ULL mod = 1LL << 58;
const ULL i55 = 6723469279985657373;
int n, x;
struct poly {
  ULL a[5];
  ULL &operator[](int index) { return a[index]; }
  ULL operator[](int index) const { return a[index]; }
  poly operator+(const poly &rhs) const {
    return (poly){a[0] + rhs[0], a[1] + rhs[1], a[2] + rhs[2], a[3] + rhs[3],
                  a[4] + rhs[4]};
  }
  poly operator-(const poly &rhs) const {
    return (poly){a[0] - rhs[0], a[1] - rhs[1], a[2] - rhs[2], a[3] - rhs[3],
                  a[4] - rhs[4]};
  }
  poly operator*(const poly &rhs) const {
    poly ret = (poly){0, 0, 0, 0, 0};
    for (int i = 0; i < 5; ++i)
      for (int j = 0; j < 5; ++j)
        if (i + j < 5)
          ret[i + j] += a[i] * rhs[j];
        else
          ret[i + j - 5] -= a[i] * rhs[j];
    return ret;
  }
} a[N];
ULL pow(ULL x, ULL y, ULL ans = 1) {
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ans = ans * x;
  return ans;
}
poly pow(poly x, ULL y, poly ans = (poly){1, 0, 0, 0, 0}) {
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ans = ans * x;
  return ans;
}
poly w10[10];
void fftinit() {
  const ULL qaq = 18446744073709551615;
  w10[0] = (poly){1, 0, 0, 0, 0};
  w10[1] = (poly){0, 1, 0, 0, 0};
  w10[2] = (poly){0, 0, 1, 0, 0};
  w10[3] = (poly){0, 0, 0, 1, 0};
  w10[4] = (poly){0, 0, 0, 0, 1};
  w10[5] = (poly){qaq, 0, 0, 0, 0};
  w10[6] = (poly){0, qaq, 0, 0, 0};
  w10[7] = (poly){0, 0, qaq, 0, 0};
  w10[8] = (poly){0, 0, 0, qaq, 0};
  w10[9] = (poly){0, 0, 0, 0, qaq};
}
void fft(poly *A, int typ) {
  if (!typ) std::reverse(w10 + 1, w10 + 10);
  poly b[10];
  for (int i = 1; i < 100000; i *= 10) {
    for (int j = 0; j < 100000; ++j)
      if (j / i % 10 == 0) {
        for (int k = 0; k < 10; ++k) {
          b[k] = (poly){0, 0, 0, 0, 0};
          for (int l = 0; l < 10; ++l)
            b[k] = b[k] + A[j + i * l] * w10[k * l % 10];
        }
        for (int k = 0; k < 10; ++k) A[j + i * k] = b[k];
      }
  }
}
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> n;
  for (int i = 1; i <= n; ++i) std::cin >> x, ++a[x][0];
  fftinit(), fft(a, 1);
  for (int i = 0; i < 100000; ++i) a[i] = pow(a[i], n);
  fft(a, 0);
  for (int i = 0; i < n; ++i)
    std::cout << ((a[i][0] - a[i][4]) * i55 / 32 & mod - 1) << '\n';
  return 0;
}
