2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
const long long LL_MAX = (1ll << 63) - 1;
struct num {
  long long v[5];
  num() { memset(v, 0, sizeof(v)); }
  num operator+(const num &a) const {
    num c;
    for (int i = (int)(0); i <= (int)(4); i++) c.v[i] = v[i] + a.v[i];
    return c;
  }
  num operator-(const num &a) const {
    num c;
    for (int i = (int)(0); i <= (int)(4); i++) c.v[i] = v[i] - a.v[i];
    return c;
  }
  num operator*(const num &a) const {
    num c;
    for (int i = (int)(0); i <= (int)(4); i++)
      for (int j = (int)(0); j <= (int)(4); j++)
        c.v[(i + j) % 5] += v[i] * a.v[j];
    return c;
  }
  num shift(int w) const {
    num c;
    for (int i = (int)(0); i <= (int)(4); i++) c.v[(i + w) % 5] = v[i];
    return c;
  }
} a[N], tmp[20];
long long power(long long x, long long y) {
  long long s = 1;
  for (; y; y /= 2, x *= x)
    if (y & 1) s *= x;
  return s;
}
num power(num x, int y) {
  num s;
  s.v[0] = 1;
  for (; y; y /= 2, x = x * x)
    if (y & 1) s = s * x;
  return s;
}
void DFT(int S, int n, int fl) {
  if (n == 1) return;
  for (int i = (int)(0); i <= (int)(9); i++) DFT(S + n / 10 * i, n / 10, fl);
  for (int i = (int)(0); i <= (int)(n / 10 - 1); i++) {
    for (int j = (int)(0); j <= (int)(9); j++)
      for (int k = (int)(0); k <= (int)(4); k++) tmp[j].v[k] = 0;
    for (int j = (int)(0); j <= (int)(9); j++)
      for (int k = (int)(0); k <= (int)(9); k++) {
        int w = (fl == 1 ? j * k % 10 : (10 - j * k % 10) % 10);
        if (w & 1)
          tmp[j] = tmp[j] - a[S + n / 10 * k + i].shift((w + 5) / 2);
        else
          tmp[j] = tmp[j] + a[S + n / 10 * k + i].shift(w / 2);
      }
    for (int j = (int)(0); j <= (int)(9); j++) a[S + n / 10 * j + i] = tmp[j];
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n); i++) {
    int x;
    scanf("%d", &x);
    ++a[x].v[0];
  }
  DFT(0, N, 1);
  for (int i = (int)(0); i <= (int)(N - 1); i++) a[i] = power(a[i], n);
  DFT(0, N, -1);
  long long inv = power(3125, LL_MAX);
  for (int i = (int)(0); i <= (int)(n - 1); i++)
    printf("%lld\n",
           (((a[i].v[0] - a[i].v[1]) >> 5) * inv) & ((1ll << 58) - 1));
}
