#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
const int N = 100005;
const ull INV5 = 14757395258967641293ull;
struct Complex {
  ull a[5] = {};
} w10[10], a[N];
const int pw[] = {1, 10, 100, 1000, 10000, 100000, 1000000};
inline Complex operator+(const Complex &a, const Complex &b) {
  Complex c;
  for (int i = 0; i < 5; i++) c.a[i] = a.a[i] + b.a[i];
  return c;
}
inline Complex operator-(const Complex &a, const Complex &b) {
  Complex c;
  for (int i = 0; i < 5; i++) c.a[i] = a.a[i] - b.a[i];
  return c;
}
inline Complex operator*(Complex a, const ull &b) {
  for (int i = 0; i < 5; i++) a.a[i] *= b;
  return a;
}
inline Complex operator*(const Complex &a, const Complex &b) {
  Complex c;
  static ull t[9];
  for (int i = 0; i < 9; i++) t[i] = 0;
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++) t[i + j] += a.a[i] * b.a[j];
  for (int i = 3; i >= 0; --i) t[i] += t[i + 5];
  for (int i = 0; i < 5; i++) c.a[i] = t[i];
  return c;
}
int rev[N];
template <typename T>
T qpow(T a, int b, T ini) {
  T ret = ini;
  while (b) {
    if (b & 1) ret = ret * a;
    a = a * a;
    b >>= 1;
  }
  return ret;
}
void FFT(Complex a[], int n, int fl) {
  for (int s = 0; s < 5; s++)
    for (int i = 0; i < n; i++)
      if ((i / pw[s]) % 10 == 0) {
        Complex b[10];
        for (int j = 0; j < 10; j++)
          for (int k = 0; k < 10; k++)
            b[j] = b[j] + a[i + k * pw[s]] * w10[(fl * j * k % 10 + 10) % 10];
        for (int j = 0; j < 10; j++) a[i + j * pw[s]] = b[j];
      }
  if (fl == -1) {
    const static ull I = qpow(INV5, 5, 1ull);
    for (int i = 0; i < n; i++) a[i] = a[i] * I;
  }
}
int main() {
  ios::sync_with_stdio(false);
  w10[0].a[0] = 1;
  w10[1].a[3] = -1;
  for (int i = 2; i < 10; i++) w10[i] = w10[i - 1] * w10[1];
  int n;
  cin >> n;
  int t1;
  for (int i = 1; i <= n; i++) cin >> t1, ++a[t1].a[0];
  FFT(a, 100000, 1);
  for (int i = 0; i < 100000; i++) a[i] = qpow(a[i], n, w10[0]);
  FFT(a, 100000, -1);
  for (int i = 0; i < n; i++)
    cout << (a[i].a[0] - a[i].a[4]) / 32 % (1ull << 58) << endl;
  return 0;
}
