2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool GetMax(T &a, T b) {
  return (a < b) ? (a = b, true) : false;
}
template <typename T>
bool GetMin(T &a, T b) {
  return (a > b) ? (a = b, true) : false;
}
const int N = 100000;
const unsigned long long Ny5 = 14757395258967641293ull;
const vector<unsigned long long> w[10] = {
    {1, 0, 0, 0, 0},     {0, 1, 0, 0, 0},     {0, 0, 1, 0, 0},
    {0, 0, 0, 1, 0},     {0, 0, 0, 0, 1},     {-1llu, 0, 0, 0, 0},
    {0, -1llu, 0, 0, 0}, {0, 0, -1llu, 0, 0}, {0, 0, 0, -1llu, 0},
    {0, 0, 0, 0, -1llu}};
vector<unsigned long long> operator*(const vector<unsigned long long> &A,
                                     const vector<unsigned long long> &B) {
  vector<unsigned long long> C(5);
  for (int i = 0; i < 5; ++i)
    if (A[i])
      for (int j = 0; j < 5; ++j)
        if (B[j])
          (i + j < 5) ? (C[i + j] += A[i] * B[j])
                      : (C[i + j - 5] -= A[i] * B[j]);
  return C;
}
void operator+=(vector<unsigned long long> &A,
                const vector<unsigned long long> &B) {
  for (int i = 0; i < 5; ++i) A[i] += B[i];
}
void Clear(vector<unsigned long long> &A) { fill(A.begin(), A.end(), 0); }
ostream &operator<<(ostream &os, vector<unsigned long long> A) {
  os << "{";
  for (vector<unsigned long long>::iterator it = A.begin(); it != A.end(); ++it)
    os << *it << ",";
  os << "}";
  return os;
}
int n;
vector<unsigned long long> A[N];
void Song(vector<unsigned long long> &A) {
  A[0] -= A[4];
  A[0] *= Ny5 * Ny5 * Ny5 * Ny5 * Ny5;
  A[0] >>= 5;
}
void Fwt(vector<unsigned long long> A[N], int fl) {
  static vector<unsigned long long> B[N];
  for (int l = 1; l < N; l *= 10) {
    copy(A, A + N, B);
    fill(A, A + N, vector<unsigned long long>(5));
    for (int i = 0; i < N; i += 10 * l) {
      for (int j = 0; j < l; ++j) {
        for (int k = 0; k < 10; ++k) {
          vector<unsigned long long> &t = A[i + j + k * l];
          for (int k2 = 0; k2 < 10; ++k2)
            t += w[(fl * k * k2 % 10 + 10) % 10] * B[i + j + k2 * l];
        }
      }
    }
  }
  if (fl == -1) {
    for (int i = 0; i < N; ++i) Song(A[i]);
  }
}
vector<unsigned long long> Qpow(vector<unsigned long long> x, int y) {
  vector<unsigned long long> res = {1, 0, 0, 0, 0};
  for (; y; y >>= 1, x = x * x)
    if (y & 1) res = res * x;
  return res;
}
bool Any(vector<unsigned long long> &A) {
  for (vector<unsigned long long>::iterator it = A.begin(); it != A.end(); ++it)
    if (*it) return true;
  return false;
}
int main() {
  scanf("%d", &n);
  fill(A, A + N, vector<unsigned long long>(5));
  for (int i = 1, x; i <= n; ++i) {
    scanf("%d", &x);
    ++A[x][0];
  }
  Fwt(A, 1);
  for (int i = 0; i < N; ++i) A[i] = Qpow(A[i], n);
  Fwt(A, -1);
  for (int i = 0; i < n; ++i) printf("%llu\n", A[i][0] % (1ull << 58));
  return 0;
}
