2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
template <int K>
struct Num {
  long long a[K];
  Num(int x = 0) { memset(a, 0, sizeof(a)), a[0] = x; }
  inline Num &operator=(const Num &t) {
    for (int i = (0); i < (K); i++) a[i] = t.a[i];
    return *this;
  }
  inline Num &operator=(int x) {
    memset(a, 0, sizeof(a)), a[0] = x;
    return *this;
  }
  inline friend Num operator+(const Num &a, const Num &b) {
    Num c;
    for (int i = (0); i < (K); i++) c.a[i] = a.a[i] + b.a[i];
    return c;
  }
  inline friend Num operator-(const Num &a, const Num &b) {
    Num c;
    for (int i = (0); i < (K); i++) c.a[i] = a.a[i] - b.a[i];
    return c;
  }
  inline friend Num operator*(const Num &a, const Num &b) {
    Num c;
    for (int i = (0); i < (K); i++)
      for (int j = (0); j < (K); j++) c.a[(i + j) % K] += a.a[i] * b.a[j];
    return c;
  }
  inline friend Num operator>>(const Num &a, int k) {
    Num c;
    for (int i = (0); i < (K); i++) c.a[(i + k) % K] = a.a[i];
    return c;
  }
  inline void print(string s = "") {
    printf("\n\n\n%s\n", s.c_str());
    for (int i = (0); i < (K); i++) printf("a[%d] => %d\n", i, a[i]);
  }
};
template <class V>
V Pow(V x, long long k) {
  V ret = 1;
  for (; k; k >>= 1, x = x * x)
    if (k & 1) ret = ret * x;
  return ret;
}
template <int M, int N, int K>
struct FT {
  Num<K> tmp[M << 1];
  int t;
  void FWT(Num<K> a[], int S, int n, int op) {
    if (n == 1) return;
    int L = n / M;
    for (int i = (0); i < (M); i++) FWT(a, S + L * i, n / M, op);
    for (int i = (0); i < (L); i++) {
      for (int j = (0); j < (M); j++) tmp[j] = 0;
      for (int j = (0); j < (M); j++)
        for (int k = (0); k < (M); k++) {
          t = op * j * k % M, t < 0 ? t += M : 0;
          if (t & 1)
            tmp[j] = tmp[j] - (a[S + L * k + i] >> (t + 5 >> 1));
          else
            tmp[j] = tmp[j] + (a[S + L * k + i] >> (t >> 1));
        }
      for (int j = (0); j < (M); j++) a[S + L * j + i] = tmp[j];
    }
  }
};
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
const int N = 1e5;
FT<10, N, 5> T;
Num<5> a[N];
int n, x;
long long inv;
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) scanf("%d", &x), a[x].a[0]++;
  T.FWT(a, 0, N, 1);
  for (int i = (0); i < (N); i++) a[i] = Pow(a[i], n);
  T.FWT(a, 0, N, -1);
  inv = Pow(3125ll, (1ll << 63) - 1);
  for (int i = (0); i < (n); i++)
    printf("%lld\n",
           (((a[i].a[0] - a[i].a[1]) >> 5) * inv) & ((1ll << 58) - 1));
  return 0;
}
