#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
struct num {
  vector<long long> z;
  num() { z = vector<long long>(5); }
  num operator+(const num &b) const {
    num c;
    for (int i = 0; i < 5; ++i) {
      c.z[i] = z[i] + b.z[i];
    }
    return c;
  }
  num operator-(const num &b) const {
    num c;
    for (int i = 0; i < 5; ++i) {
      c.z[i] = z[i] - b.z[i];
    }
    return c;
  }
  num operator*(const num &b) const {
    num c;
    for (int i = 0; i < 5; ++i) {
      for (int j = 0; j < 5; ++j) {
        c.z[(i + j) % 5] += z[i] * b.z[j];
      }
    }
    return c;
  }
  num shift(int w) {
    num res;
    for (int i = 0; i < 5; ++i) {
      res.z[(i + w) % 5] = z[i];
    }
    return res;
  }
};
long long power(long long x, long long y) {
  long long res = 1;
  for (; y; y >>= 1, x *= x) {
    if (y & 1) {
      res *= x;
    }
  }
  return res;
}
num power(num x, int y) {
  num res;
  res.z[0] = 1;
  for (; y; y >>= 1, x = x * x) {
    if (y & 1) {
      res = res * x;
    }
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<num> a(N);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++a[x].z[0];
  }
  vector<num> temp(10);
  int base[5];
  base[0] = 1;
  for (int i = 1; i < 5; i++) base[i] = 10 * base[i - 1];
  function<void(bool)> dft = [&](bool idft) {
    for (int i = 0; i < 5; i++) {
      for (int k = 0; k < N; k++) {
        if ((k / base[i]) % 10 == 0) {
          fill(temp.begin(), temp.end(), num());
          for (int u = 0; u < 10; u++) {
            for (int v = 0; v < 10; v++) {
              int w = u * v % 10;
              if (idft) w = 10 - w;
              for (int ii = 0; ii < 5; ii++) {
                if (w & 1)
                  temp[u].z[ii] =
                      temp[u].z[ii] -
                      a[k + v * base[i]].z[(ii + ((w + 5) >> 1)) % 5];
                else
                  temp[u].z[ii] =
                      temp[u].z[ii] + a[k + v * base[i]].z[(ii + (w >> 1)) % 5];
              }
            }
          }
          for (int u = 0; u < 10; u++) a[k + u * base[i]] = temp[u];
        }
      }
    }
  };
  dft(false);
  for (int i = 0; i < N; ++i) {
    a[i] = power(a[i], n);
  }
  dft(true);
  long long inv = power(3125, LLONG_MAX);
  for (int i = 0; i < n; ++i) {
    cout << ((a[i].z[0] - a[i].z[1] >> 5) * inv & (1ll << 58) - 1) << "\n";
  }
  return 0;
}
