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>
const int mod = 1e9 + 7;
const int N = 5050;
int pow(int x, int k) {
  int ret = 1;
  for (; k; k >>= 1, x = (long long)x * x % mod)
    if (k & 1) ret = (long long)ret * x % mod;
  return ret;
}
int inv(int x) { return pow(x, mod - 2); }
int a[N], sz[N], isz[N], dp[N][N * 2], sol[N * 2], n;
bool vis[N][N * 2];
int DP(int h, int k) {
  if (h == 0) return dp[k][h] = 1;
  if (k == 1) return dp[k][h] = 0;
  if (vis[k][h]) return dp[k][h];
  vis[k][h] = 1;
  dp[k][h] = DP(h - 1, k - 1);
  if (h > 1 && k + h - 2 <= n)
    dp[k][h] += (long long)sz[k + h - 2] * isz[k] % mod * (a[k - 1] - 1) % mod;
  if (dp[k][h] >= mod) dp[k][h] -= mod;
  return dp[k][h];
}
int main() {
  int i, j;
  scanf("%i", &n);
  for (i = 1; i < n; i++) scanf("%i", &a[i]);
  sz[1] = 1;
  for (i = 2; i <= n; i++)
    sz[i] = (long long)sz[i - 1] * a[i - 1] % mod, isz[i] = inv(sz[i]);
  for (i = 1; i <= n; i++) {
    int s = 1;
    for (j = i + 1; j <= n; j++) {
      s = (long long)s * a[j - 1] % mod;
      sol[j - i] += (long long)s * sz[i] % mod;
      if (sol[j - i] >= mod) sol[j - i] -= mod;
    }
  }
  for (i = 1; i < 2 * n - 1; i++) {
    for (j = 1; j <= n; j++) {
      sol[i] += (long long)DP(i, j) * sz[j] % mod;
      if (sol[i] >= mod) sol[i] -= mod;
    }
    sol[i] = (long long)sol[i] * inv(2) % mod;
    printf("%i ", sol[i]);
  }
  printf("\n");
  return 0;
}