Problem: You generate real numbers s1, s2, ..., sn as follows: 

  * s0 = 0; 
  * si = si - 1 + ti, where ti is a real number chosen independently uniformly at random between 0 and 1, inclusive. 



You are given real numbers x1, x2, ..., xn. You are interested in the probability that si ≤ xi is true for all i simultaneously.

It can be shown that this can be represented as <image>, where P and Q are coprime integers, and <image>. Print the value of P·Q - 1 modulo 998244353.

Input

The first line contains integer n (1 ≤ n ≤ 30).

The next n lines contain real numbers x1, x2, ..., xn, given with at most six digits after the decimal point (0 < xi ≤ n).

Output

Print a single integer, the answer to the problem.

Examples

Input

4
1.00
2
3.000000
4.0


Output

1


Input

1
0.50216


Output

342677322


Input

2
0.5
1.0


Output

623902721


Input

6
0.77
1.234567
2.1
1.890
2.9999
3.77


Output

859831967

Note

In the first example, the sought probability is 1 since the sum of i real numbers which don't exceed 1 doesn't exceed i.

In the second example, the probability is x1 itself.

In the third example, the sought probability is 3 / 8.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 50, B = 1000000, mod = 998244353, inv_B = 616898040;
int inv[N], dp[N * N][N], L[N * N], val[N * N], a[N], b[N], n;
inline void reduce(int& x) { x += x >> 31 & mod; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = mod - mod / i * (long long)inv[mod % i] % mod;
  for (int i = 1; i <= n; ++i) {
    double t;
    cin >> t;
    a[i] = round(t * B);
    b[i] = a[i] % B;
  }
  sort(b, b + n + 1);
  int m = unique(b, b + n + 1) - b;
  val[n * m] = n * B;
  for (int i = n * m - 1; i >= 0; --i) {
    val[i] = (i / m) * B + b[i % m];
    L[i] = (long long)(val[i + 1] - val[i]) * inv_B % mod;
  }
  for (int i = 0; i <= n * m; ++i) dp[i][0] = 1;
  for (int i = 1; i <= n; ++i) {
    int u = lower_bound(val, val + n * m + 1, a[i]) - val, sum = 0;
    for (int j = 0; j <= n * m; ++j) {
      for (int k = n; k; --k) dp[j][k] = (long long)dp[j][k - 1] * inv[k] % mod;
      dp[j][0] = sum;
      sum = 0;
      for (int k = n; k >= 0; --k)
        sum = ((long long)sum * L[j] + dp[j][k]) % mod;
    }
    for (int j = n * m; j >= m; --j)
      for (int k = 0; k <= n; ++k) reduce(dp[j][k] -= dp[j - m][k]);
    for (int j = u; j <= n * m; ++j) {
      for (int k = 1; k <= n; ++k) dp[j][k] = 0;
      dp[j][0] = dp[u][0];
    }
  }
  cout << dp[n * m][0] << '\n';
  return 0;
}