2
0 1
 1
0

1
2
 1

#include <bits/stdc++.h>
using namespace std;
struct poly {
  array<unsigned long long, 10> ar;
  poly() { ar.fill(0); }
  poly(unsigned long long x) {
    ar.fill(0);
    ar[0] = x;
  }
  poly &operator+=(const poly &pp) {
    for (int i = 0; i < 10; i++) {
      ar[i] += pp.ar[i];
    }
    return *this;
  }
  poly &operator-=(const poly &pp) {
    for (int i = 0; i < 10; i++) {
      ar[i] -= pp.ar[i];
    }
    return *this;
  }
  poly operator*(const poly &pp) const {
    poly ret;
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        ret.ar[(i + j) % 10] += ar[i] * pp.ar[j];
      }
    }
    return ret;
  }
  poly modpow(int n) const {
    poly ret(1);
    poly mul = *this;
    while (n) {
      if (n % 2 == 1) ret = ret * mul;
      n /= 2;
      mul = mul * mul;
    }
    return ret;
  }
  poly shift(int x) const {
    poly ret;
    for (int i = 0; i < 10; i++) {
      ret.ar[(i + x) % 10] = ar[i];
    }
    return ret;
  }
  unsigned long long calc() const {
    poly cpy = *this;
    for (int i = 0; i < 5; i++) {
      cpy.ar[i] -= cpy.ar[i + 5];
    }
    unsigned long long w = cpy.ar[4];
    cpy.ar[4] -= w;
    cpy.ar[3] += w;
    cpy.ar[2] -= w;
    cpy.ar[1] += w;
    cpy.ar[0] -= w;
    return cpy.ar[0];
  }
};
const int mx = 100000;
poly num[mx + 10];
void DFT(int dif, bool rev) {
  int dir = (rev ? 10 - 1 : 1);
  for (int beg = 0; beg < mx; beg++) {
    if (beg % (dif * 10) >= dif) continue;
    int look[10];
    for (int i = 0; i < 10; i++) look[i] = beg + i * dif;
    poly tmp[10];
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        tmp[i] += num[look[j]].shift((i * j * dir) % 10);
      }
    }
    for (int i = 0; i < 10; i++) {
      num[look[i]] = tmp[i];
    }
  }
}
array<unsigned long long, mx + 10> ans;
int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    num[x].ar[0]++;
  }
  for (int coef = 1; coef < mx; coef *= 10) {
    DFT(coef, false);
  }
  for (int i = 0; i < mx; i++) {
    num[i] = num[i].modpow(n);
  }
  for (int coef = 1; coef < mx; coef *= 10) {
    DFT(coef, true);
  }
  for (int i = 0; i < n; i++) {
    ans[i] = num[i].calc();
    assert(ans[i] % 32ULL == 0);
    ans[i] /= 32ULL;
    unsigned long long y = (1ull << 63) / 5;
    unsigned long long x = y * 2 + 1;
    unsigned long long rev = x * 4 + 1;
    for (int j = 0; j < 5; j++) ans[i] = ans[i] * rev;
    ans[i] %= (1ull << 58);
    cout << ans[i] << endl;
  }
}
