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 long long mod = (int)1e9 + 7;
const int Max = 5001;
int arr[Max], arrInv[Max], cntPaths[Max][Max], answer[Max + Max], cntNodes[Max],
    cntPaths2[Max][Max], up[Max + Max];
long long power(long long a, long long b, long long c = mod) {
  if (b <= 0) return 1;
  long long temp = power(a, b / 2, c) % c;
  if (b % 2 == 0) {
    return (temp * temp) % c;
  } else {
    return (((a * temp) % c) * temp) % c;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; ++i) {
    cin >> arr[i];
    arrInv[i] = power(arr[i], mod - 2);
  }
  cntNodes[1] = 1;
  for (int i = 2; i <= n; ++i) {
    cntNodes[i] = (1LL * cntNodes[i - 1] * arr[i - 1]) % mod;
  }
  for (int len = 1; len <= n - 1; ++len) {
    cntPaths[len][n] = 1;
    cntPaths2[0][n] = 1;
    cntPaths2[len][n] = 1;
    for (int depth = n - 1; depth >= 1; --depth) {
      cntPaths2[0][depth] = 1;
      cntPaths[len][depth] =
          (1LL * cntPaths[len][depth + 1] * arr[depth]) % mod;
      if (depth + len <= n - 1) {
        cntPaths[len][depth] =
            (1LL * cntPaths[len][depth] * arrInv[depth + len]) % mod;
      }
      cntPaths2[len][depth] =
          (1LL * cntPaths[len][depth] * arrInv[depth]) % mod;
      cntPaths2[len][depth] =
          (1LL * cntPaths2[len][depth] * (arr[depth] - 1)) % mod;
    }
  }
  for (int len = 1; len <= 2 * n - 2; ++len) answer[len] = up[len] = 0;
  for (int len = 1; len <= n - 1; ++len) {
    for (int depth = 1; depth + len <= n; ++depth) {
      answer[len] += (1LL * cntNodes[depth] * cntPaths[len][depth]) % mod;
      answer[len] %= mod;
    }
  }
  for (int depth = 2; depth <= n; ++depth) {
    for (int len = depth - 1 + n - 1; len >= 2; --len) {
      up[len] = up[len - 1];
    }
    up[1] = 0;
    for (int amountDown = 0; depth - 1 + amountDown <= n; ++amountDown) {
      int len = 1 + amountDown;
      up[len] += cntPaths2[amountDown][depth - 1];
      up[len] %= mod;
    }
    for (int len = 1; len <= depth - 1 + n - 1; ++len) {
      answer[len] += (1LL * cntNodes[depth] * up[len]) % mod;
      answer[len] %= mod;
    }
  }
  long long divideTwo = power(2, mod - 2);
  for (int len = 1; len <= 2 * n - 2; ++len) {
    cout << (1LL * answer[len] * divideTwo) % mod << ' ';
  }
  cout << '\n';
  return 0;
}