Problem: You are given a rooted tree. Let's denote d(x) as depth of node x: depth of the root is 1, depth of any other node x is d(y) + 1, where y is a parent of x.

The tree has the following property: every node x with d(x) = i has exactly ai children. Maximum possible depth of a node is n, and an = 0.

We define fk as the number of unordered pairs of vertices in the tree such that the number of edges on the simple path between them is equal to k.

Calculate fk modulo 109 + 7 for every 1 ≤ k ≤ 2n - 2.

Input

The first line of input contains an integer n (2 ≤ n ≤ 5 000) — the maximum depth of a node.

The second line of input contains n - 1 integers a1, a2, ..., an - 1 (2 ≤ ai ≤ 109), where ai is the number of children of every node x such that d(x) = i. Since an = 0, it is not given in the input.

Output

Print 2n - 2 numbers. The k-th of these numbers must be equal to fk modulo 109 + 7.

Examples

Input

4
2 2 2


Output

14 19 20 20 16 16 

Input

3
2 3


Output

8 13 6 9 

Note

This the tree from the first sample: 

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[5000];
long long nodecount[5000];
long long mod = 1000000007;
long long ans[10000];
long long* fp;
long long* fc;
long long* nfp;
long long* nfc;
static long long solveCongruence(long long a, long long b, long long mod) {
  if (a == 1) {
    return b;
  }
  long long b1 = -b % a;
  if (b1 != 0) {
    b1 += a;
  }
  long long y = solveCongruence(mod % a, b1, a);
  return (mod * y + b) / a % mod;
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) cin >> a[i];
  a[n - 1] = 0;
  nodecount[0] = 1;
  for (int i = 0; i < n - 1; i++) nodecount[i + 1] = nodecount[i] * a[i] % mod;
  fp = new long long[n];
  fc = new long long[n];
  nfp = new long long[n];
  nfc = new long long[n];
  ans[1] = 0;
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      ans[1] += nodecount[i];
      ans[1] %= mod;
      fp[i] = 1;
    } else
      fp[i] = 0;
    if (i < n - 1) {
      ans[1] += nodecount[i] * a[i] % mod;
      ans[1] %= mod;
      fc[i] = 1;
    } else
      fc[i] = 0;
  }
  for (int len = 2; len <= 2 * n - 2; len++) {
    ans[len] = 0;
    for (int i = 0; i < n; i++) nfp[i] = nfc[i] = 0;
    for (int i = 0; i < n; i++) {
      if (fc[i] > 0) {
        if (i > 0) {
          ans[len] += fc[i] * a[i] % mod * nodecount[i] % mod;
          ans[len] %= mod;
          nfc[i - 1] += fc[i] * a[i] % mod;
          nfc[i - 1] %= mod;
        }
        ans[len] += fc[i] * (a[i] - 1) % mod * a[i] % mod * nodecount[i] % mod;
        ans[len] %= mod;
        nfp[i + 1] += fc[i] * (a[i] - 1) % mod;
        nfp[i + 1] %= mod;
      }
      if (fp[i] > 0 && i < n - 1) {
        ans[len] += fp[i] * a[i] % mod * nodecount[i] % mod;
        ans[len] %= mod;
        nfp[i + 1] += fp[i];
        nfp[i + 1] %= mod;
      }
    }
    long long* temp = fp;
    fp = nfp;
    nfp = temp;
    temp = fc;
    fc = nfc;
    nfc = temp;
  }
  for (int i = 1; i <= 2 * n - 2; i++) ans[i] = solveCongruence(2, ans[i], mod);
  cout << ans[1];
  for (int i = 2; i <= 2 * n - 2; i++) cout << " " << ans[i];
  cout << endl;
  delete[] fp;
  delete[] fc;
  delete[] nfp;
  delete[] nfc;
  return 0;
}