2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
struct Int {
  unsigned long long a[5];
  Int() { memset(a, 0, sizeof(a)); }
  Int operator+(const Int &b) const {
    Int ans;
    for (int i = (int)(0); i <= (int)(4); i++) ans.a[i] = a[i] + b.a[i];
    return ans;
  }
  Int operator-(const Int &b) const {
    Int ans;
    for (int i = (int)(0); i <= (int)(4); i++) ans.a[i] = a[i] - b.a[i];
    return ans;
  }
  Int operator*(const Int &b) const {
    Int ans;
    for (int i = (int)(0); i <= (int)(4); i++)
      for (int j = (int)(0); j <= (int)(4); j++)
        ans.a[(i + j) % 5] += a[i] * b.a[j];
    return ans;
  }
  Int shift(int x) {
    Int ans;
    for (int i = (int)(0); i <= (int)(4); i++) ans.a[(i + x) % 5] = a[i];
    return ans;
  }
} a[N], tmp[10];
int n;
Int power(Int x, int y) {
  Int s;
  s.a[0] = 1;
  for (; y; y /= 2, x = x * x)
    if (y & 1) s = s * x;
  return s;
}
unsigned long long power(unsigned long long x, long long y) {
  unsigned long long s = 1;
  for (; y; y /= 2, x *= x)
    if (y & 1) s *= x;
  return s;
}
void FWT(Int *a, int n, int f) {
  if (n == 1) return;
  for (int i = (int)(0); i <= (int)(9); i++) FWT(a + n / 10 * i, n / 10, f);
  for (int i = (int)(0); i <= (int)(n / 10 - 1); i++) {
    memset(tmp, 0, sizeof(tmp));
    for (int j = (int)(0); j <= (int)(9); j++)
      for (int k = (int)(0); k <= (int)(9); k++) {
        int b = (10 + j * k * f % 10) % 10;
        if (b & 1)
          tmp[j] = tmp[j] - a[n / 10 * k + i].shift((b + 5) / 2);
        else
          tmp[j] = tmp[j] + a[n / 10 * k + i].shift(b / 2);
      }
    for (int j = (int)(0); j <= (int)(9); j++) a[n / 10 * j + i] = tmp[j];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n); i++) {
    int x;
    scanf("%d", &x);
    ++a[x].a[0];
  }
  FWT(a, N, 1);
  for (int i = (int)(0); i <= (int)(N - 1); i++) a[i] = power(a[i], n);
  FWT(a, N, -1);
  unsigned long long Inv = power(3125, (1ull << 63) - 1);
  for (int i = (int)(0); i <= (int)(n - 1); i++) {
    unsigned long long ans = (a[i].a[0] - a[i].a[1]) / 32;
    ans = (ans * Inv) & ((1ull << 58) - 1);
    printf("%llu\n", ans);
  }
}
