2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
   
typedef long long lo;
   
template<typename tp> inline void read(tp &x) {
  x = 0; char c = getchar(); int f = 0;
  for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if (f) x = -x;
}

typedef unsigned long long Long;

struct poly {
  Long a[5];
  poly(int k = 0) {
    a[0] = 1;
  }
  Long& operator [] (int x) {return a[x];}
  const Long& operator [] (int x) const {return a[x];}
  friend poly operator * (poly a, poly b) {
    poly ans = 0;
    re0 (i, 5) if (a[i]) re0 (j, 5) if (b[j]) {
	ans[i + j >= 5 ? i + j - 5 : i + j] += a[i] * b[j];
      }
    return ans;
  }
  friend void operator += (poly &a, poly b) {
    re0 (i, 5) a[i] += b[i];
  }
};
const int N = 1e5 + 233;
poly a[N], to[N], w[11];
int m, x;
const int n = 1e5;
template <class T>
inline T power(T a, Long k) {
  T ans = 1;
  for (; k; k >>= 1, a = a * a)
    if (k & 1) ans = ans * a;
  return ans;
}

inline void fwt(poly *a, int n, int fff) {
  for (int l = 10; l <= n; l *= 10)
    for (int j = 0, m = l / 10; j < n; j += l)
      for (int k = 0; k < m; k++) {
	for (int x = 0; x < 10; x++)
	  to[j + k + x * m] = a[j + k + x * m];
	for (int x = 0; x < 10; x++)
	  for (int y = 0; y < 10; y++)
	    a[j + k + x * m] += w[x * y * fff % 10] * to[j + k + y * m];
      }
}

int main(void) {
  read(m);
  rep (i, m) read(x), ++a[x][0];
  re0 (i, 10) w[i][i % 5] = i & 1 ? -1 : 1;
  fwt(a, n, 1);
  re0 (i, n) a[i] = power(a[i], m);
  fwt(a, n, 9);
  Long mo = 1ll << 58;
  Long invn = power((Long) 125 * 25, (mo / 2) - 1);
  re0 (i, m) {
    // cout << a[i][0] - a[i][1] << "\n";
    cout << (((a[i][0] - a[i][1]) * invn) >> 5) % mo << "\n";
  }
}