2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
unsigned long long fpow(unsigned long long a, unsigned long long b) {
  unsigned long long ans = 1, t = a;
  while (b) {
    if (b & 1) ans = ans * t;
    t = t * t;
    b >>= 1;
  }
  return ans;
}
struct Num {
  unsigned long long a[10];
  Num() { memset(a, 0, sizeof(a)); }
  Num(int x) {
    memset(a, 0, sizeof(a));
    a[(x % 10 + 10) % 10] = 1;
  }
};
Num operator+(const Num& a, const Num& b) {
  Num ans;
  for (int i = 0; i < 10; i++) ans.a[i] = a.a[i] + b.a[i];
  return ans;
}
Num operator-(const Num& a, const Num& b) {
  Num ans;
  for (int i = 0; i < 10; i++) ans.a[i] = a.a[i] - b.a[i];
  return ans;
}
Num operator*(const Num& a, const Num& b) {
  Num ans;
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) ans.a[(i + j) % 10] += a.a[i] * b.a[j];
  return ans;
}
Num fpow(Num a, unsigned long long b) {
  Num ans = Num(0), t = a;
  while (b) {
    if (b & 1) ans = ans * t;
    t = t * t;
    b >>= 1;
  }
  return ans;
}
Num trans(Num a, int b) {
  b = (b % 10 + 10) % 10;
  Num res;
  for (int i = 0; i < 10; i++) res.a[(i + b) % 10] = a.a[i];
  return res;
}
const int N = 100000;
Num f[100010];
Num g[10];
void calc(int i, int step, int t) {
  for (int j = 0; j < 10; j++) g[j] = f[i + step * j];
  for (int j = 0; j < 10; j++) {
    f[i + step * j] = Num();
    for (int k = 0; k < 10; k++)
      f[i + step * j] = f[i + step * j] + trans(g[k], t * j * k);
  }
  return;
}
void work(int t) {
  for (int step = 1; step < N; step *= 10)
    for (int i = 0; i < N; i += step * 10)
      for (int j = i; j < i + step; j++) calc(j, step, t);
  return;
}
const unsigned long long Mod = 1ull << 58;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    f[x].a[0]++;
  }
  work(1);
  for (int i = 0; i < N; i++) f[i] = fpow(f[i], (unsigned long long)n);
  work(-1);
  unsigned long long val = 5 * 5 * 5 * 5 * 5;
  val = fpow(val, (1ull << 63) - 1);
  for (int i = 0; i < n; i++) {
    for (int j = 5; j < 10; j++) f[i].a[j - 5] -= f[i].a[j];
    unsigned long long res = f[i].a[0] - f[i].a[4];
    res >>= 5;
    res *= val;
    cout << res % Mod << "\n";
  }
  return 0;
}
