2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
using i32 = int;
using i64 = long long;
using u8 = unsigned;
using f80 = long double;
using u64 = unsigned long long;
using f64 = double;
const int maxN = 1e5;
const int DEG = 4;
const int BASE = 10;
const int MAXP = 1e7;
const int MOD = 1e9 + 7;
const f80 MI = f80(1) / MOD;
const long long INF = 10000000000000000LL;
const long long inf = 5000000000000LL;
int n;
template <class T>
struct node {
  T v[DEG];
  node(T c = 0, int k = 0) {
    for (int i = 0; i < DEG; i++) {
      v[i] = 0;
    }
    v[k] = c;
  }
  node(T *s, T *t) {
    assert(t - s == DEG);
    for (int i = 0; i < DEG; i++) {
      v[i] = s[i];
    }
  }
  node &operator+=(const node &A) {
    for (int i = 0; i < DEG; i++) {
      v[i] += A.v[i];
    }
    return *this;
  }
  friend node operator*(const node &A, const node &B) {
    T t[DEG * 2] = {};
    for (int i = 0; i < DEG; i++) {
      for (int j = 0; j < DEG; j++) {
        t[i + j] += A.v[i] * B.v[j];
      }
    }
    for (int i = 2 * DEG - 2; i >= DEG; i--) {
      t[i - 1] += t[i];
      t[i - 2] -= t[i];
      t[i - 3] += t[i];
      t[i - 4] -= t[i];
    }
    return node(t, t + DEG);
  }
  node &operator*=(const node &A) { return *this = *this * A; }
};
template <class T, class V>
T power(T a, V n) {
  if (n == 0) return 1;
  T t = power(a, n / 2);
  t = t * t;
  if (n % 2 == 1) t = t * a;
  return t;
}
node<u64> a[maxN];
node<u64> w[BASE];
void fft(bool inv = 0) {
  int shift = inv ? BASE - 1 : 1;
  for (int step = 1; step < maxN; step *= BASE) {
    for (int offset = 0; offset < maxN; offset++) {
      if (offset / step % BASE != 0) continue;
      node<u64> to[BASE];
      for (int i = 0; i < BASE; i++) {
        for (int j = 0; j < BASE; j++) {
          to[i] += w[i * j * shift % BASE] * a[offset + j * step];
        }
      }
      for (int i = 0; i < BASE; i++) {
        a[offset + i * step] = to[i];
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[x] += 1;
  }
  w[0] = 1;
  w[1] = node<u64>(1, 1);
  for (int i = 2; i < BASE; i++) {
    w[i] = w[i - 1] * w[1];
  }
  fft();
  for (int i = 0; i < maxN; i++) {
    a[i] = power(a[i], n);
  }
  fft(1);
  for (int i = 0; i < n; i++) {
    u64 ans = a[i].v[0];
    ans *= 6723469279985657373ULL;
    ans >>= 5;
    printf("%llu\n", ans % (1ULL << 58));
  }
  return 0;
}
