2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n;
struct cp {
  unsigned long long x[5];
  void clear() { memset(x, 0, sizeof(x)); }
  cp operator+(const cp& k) const {
    cp t;
    for (int i = (0); i <= (4); ++i) t.x[i] = x[i] + k.x[i];
    return t;
  }
  cp operator-(const cp& k) const {
    cp t;
    for (int i = (0); i <= (4); ++i) t.x[i] = x[i] - k.x[i];
    return t;
  }
  cp operator*(const cp& k) const {
    static int tmp[10];
    memset(tmp, 0, sizeof(tmp));
    for (int i = (0); i <= (4); ++i)
      for (int j = (0); j <= (4); ++j) tmp[i + j] += x[i] * k.x[j];
    cp t;
    for (int i = (0); i <= (4); ++i) t.x[i] = tmp[i] - tmp[i + 5];
    return t;
  }
} w[10], a[N];
const static int lim = 100000;
void fwt(cp* a, int o) {
  for (int i = 1; i < lim; i *= 10) {
    for (int j = 0; j < lim; j += i * 10) {
      for (int k = 0; k < i; ++k) {
        static cp b[10];
        int top = 0;
        for (int t = (0); t <= (9); ++t) {
          b[top++] = a[i * t + j + k];
        }
        for (int t = (0); t <= (9); ++t) {
          cp& c = a[i * t + j + k];
          c.clear();
          for (int q = (0); q <= (9); ++q) {
            c = c + b[q] * w[t * q * o % 10];
          }
        }
      }
    }
  }
}
cp po(cp k1, int k2) {
  cp k3;
  k3.clear();
  k3.x[0] = 1;
  for (; k2; k2 >>= 1, k1 = k1 * k1)
    if (k2 & 1) k3 = k3 * k1;
  return k3;
}
int main() {
  w[0].x[0] = 1;
  {
    cp wn;
    wn.clear();
    wn.x[1] = 1;
    for (int i = (1); i <= (9); ++i) w[i] = w[i - 1] * wn;
  }
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) {
    int x;
    scanf("%d", &x);
    ++a[x].x[0];
  }
  fwt(a, 1);
  for (int i = (0); i <= (lim - 1); ++i) a[i] = po(a[i], n);
  fwt(a, 9);
  const unsigned long long I = 6723469279985657373ULL;
  for (int i = (0); i <= (n - 1); ++i) {
    unsigned long long res = a[i].x[0] - a[i].x[2];
    printf("%llu\n", (res * I) >> 5 & ((1ULL << 58) - 1));
  }
  return 0;
}
