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;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 15005;
const double PI = acos(-1.0);
const double eps = 1e-9;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  string s = "/home/jslijin/jslijin/code/";
  freopen((s + "code.in").c_str(), "r", stdin);
  freopen((s + "code.out").c_str(), "w", stdout);
}
int dp[5005][10005];
long long a[N], s[N], ans[N], rev_2;
int n;
long long Pow(long long x, long long k) {
  long long ans = 1;
  for (; k; k >>= 1, (x *= x) %= _p)
    if (k & 1) (ans *= x) %= _p;
  return ans;
}
int main() {
  scanf("%d", &n), rev_2 = Pow(2, _p - 2), s[0] = 1;
  for (int i = (1); i <= (n - 1); ++i)
    scanf("%lld", &a[i]), s[i] = s[i - 1] * a[i] % _p;
  for (int i = (1); i <= (n); ++i) dp[i][0] = s[i - 1];
  for (int i = (n - 1); i >= (2); --i)
    for (int l = (1); l <= (2 * (n - i)); ++l) {
      dp[i][l] = 2 * s[i + l - 1] % _p;
      if (l >= 2) (dp[i][l] += a[i] * dp[i + 1][l - 2] % _p) %= _p;
    }
  for (int l = (1); l <= (2 * n - 2); ++l)
    for (int i = (1); i <= (n - l / 2); ++i) {
      (ans[l] += s[i + l - 1]) %= _p;
      if (l >= 2)
        (ans[l] += (a[i] - 1) * rev_2 % _p * dp[i + 1][l - 2] % _p) %= _p;
    }
  for (int i = (1); i <= (2 * n - 2); ++i) printf("%lld ", ans[i]);
  return 0;
}