Problem: Let's define radix sum of number a consisting of digits a_1, … ,a_k and number b consisting of digits b_1, … ,b_k(we add leading zeroes to the shorter number to match longer length) as number s(a,b) consisting of digits (a_1+b_1)mod 10, … ,(a_k+b_k)mod 10. The radix sum of several integers is defined as follows: s(t_1, … ,t_n)=s(t_1,s(t_2, … ,t_n))

You are given an array x_1, … ,x_n. The task is to compute for each integer i (0 ≤ i < n) number of ways to consequently choose one of the integers from the array n times, so that the radix sum of these integers is equal to i. Calculate these values modulo 2^{58}.

Input

The first line contains integer n — the length of the array(1 ≤ n ≤ 100000).

The second line contains n integers x_1, … x_n — array elements(0 ≤ x_i < 100000).

Output

Output n integers y_0, …, y_{n-1} — y_i should be equal to corresponding number of ways modulo 2^{58}.

Examples

Input


2
5 6


Output


1
2


Input


4
5 7 5 7


Output


16
0
64
0

Note

In the first example there exist sequences: sequence (5,5) with radix sum 0, sequence (5,6) with radix sum 1, sequence (6,5) with radix sum 1, sequence (6,6) with radix sum 2.

Solution (in CPP):

Solution:
#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;
}