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 = 55, B = 1000000, P = 998244353, invB = 616898040;
using ll = long long;
ll inv[N], dp[N * N][N];
int l[N * N], val[N * N], a[N], b[N], n;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  inv[1] = 1;
  for (int i = 2; i <= n; i++) inv[i] = P - P / i * inv[P % i] % P;
  for (int i = 1; i <= n; i++) {
    double t;
    cin >> t;
    a[i] = t * B + 0.5;
    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] = ll(val[i + 1] - val[i]) * invB % P;
  }
  for (int i = 0; i <= n * m; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    int tt = lower_bound(val + 1, val + n * m + 1, a[i]) - val;
    ll sum = 0;
    for (int j = 0; j <= n * m; j++) {
      for (int k = n; k > 0; --k) dp[j][k] = dp[j][k - 1] * inv[k] % P;
      dp[j][0] = sum;
      sum = 0;
      for (int k = n; k >= 0; --k) sum = (sum * l[j] + dp[j][k]) % P;
    }
    for (int j = n * m; j >= m; --j)
      for (int k = 0; k <= n; k++) dp[j][k] = (dp[j][k] - dp[j - m][k] + P) % P;
    for (int j = tt; j <= n * m; j++) {
      for (int k = 1; k <= n; k++) dp[j][k] = 0;
      dp[j][0] = dp[tt][0];
    }
  }
  cout << dp[n * m][0] << endl;
  return 0;
}