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 = 31, mod = 998244353, B = 1e6, IB = 616898040;
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) return a = b, 1;
  return 0;
}
void qmo(int &x) { x += x >> 31 & mod; }
int n, m, a[N], inv[N], val[N * N], len[N * N], sum[N * N], coe[N * N][N], ans;
vector<int> cut;
double x;
int id(int x) { return lower_bound(val, val + n * m + 1, x) - val; }
int main() {
  scanf("%d", &n);
  inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = mod - (long long)mod / i * inv[mod % i] % mod;
  for (int i = 0; i < n; ++i) {
    scanf("%lf", &x);
    a[i] = (int)(x * B + 0.5);
    chmin(a[i], (i + 1) * B);
    cut.emplace_back(a[i] % B);
  }
  cut.emplace_back(0);
  sort(cut.begin(), cut.end());
  cut.erase(unique(cut.begin(), cut.end()), cut.end());
  m = cut.size();
  for (int i = n * m; ~i; --i) val[i] = i / m * B + cut[i % m];
  for (int i = n * m - 1; ~i; --i)
    len[i] = ((long long)val[i + 1] - val[i]) * IB % mod;
  for (int i = id(a[0]) - 1; ~i; --i) {
    sum[i] = len[i];
    coe[i][1] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int _ = id(a[i]);
    for (int j = _; j < (i + 1) * m; ++j) {
      memset(coe[j], 0, n + 1 << 2);
      sum[j] = 0;
    }
    for (int j = _ - 1; ~j; --j) {
      for (int k = j - 1; ~k && k >= j - m; --k) qmo(coe[j][0] += sum[k] - mod);
      if (j >= m)
        for (int k = 1; k <= i; ++k) qmo(coe[j][k] -= coe[j - m][k]);
      for (int k = i + 1; k; --k)
        coe[j][k] = (long long)coe[j][k - 1] * inv[k] % mod;
      coe[j][0] = sum[j] = 0;
      for (int k = i + 1; ~k; --k)
        sum[j] = ((long long)sum[j] * len[j] + coe[j][k]) % mod;
    }
  }
  for (int i = 0; i < n * m; ++i) qmo(ans += sum[i] - mod);
  printf("%d\n", ans);
}