#include <bits/stdc++.h>
using namespace std;
const int N = 35;
const int B = 1000000;
const int mod = 998244353;
int n, m, invB;
int inv[N], a[N], sum[N * N], sz[N * N], p[N * N], f[N * N][N];
inline int ksm(int x, int p) {
  int ret = 1;
  for (; p; p >>= 1, x = (long long)x * x % mod)
    if (p & 1) ret = (long long)ret * x % mod;
  return ret;
}
inline void upd(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int get(int x) { return find(p, p + (n * m + 1), x) - p; }
int main() {
  inv[1] = 1;
  for (int i = 2; i < N; i++)
    inv[i] = (long long)inv[mod % i] * (mod - mod / i) % mod;
  invB = ksm(B, mod - 2);
  vector<int> v;
  v.push_back(0);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    double tmp;
    scanf("%lf", &tmp);
    a[i] = (int)(tmp * B + 0.5);
    v.push_back(a[i] % B);
  }
  sort((v).begin(), (v).end());
  v.erase(unique((v).begin(), (v).end()), v.end());
  m = (int)v.size();
  for (int i = n * m; i >= 0; i--) {
    p[i] = (i / m) * B + v[i % m];
    if (i < n * m) sz[i] = (long long)(p[i + 1] - p[i]) * invB % mod;
  }
  for (int i = min(m, get(a[0])) - 1; i >= 0; i--) {
    sum[i] = sz[i];
    f[i][1] = 1;
  }
  for (int i = 1; i < n; i++) {
    int cut = get(a[i]);
    for (int j = n * m - 1; j >= 0; j--)
      if (j < cut) {
        for (int k = max(0, j - m); k < j; k++) upd(f[j][0], sum[k]);
        if (j >= m)
          for (int k = 0; k <= n; k++) upd(f[j][k], mod - f[j - m][k]);
        for (int k = n - 1; k >= 0; k--)
          f[j][k + 1] = (long long)f[j][k] * inv[k + 1] % mod;
        f[j][0] = sum[j] = 0;
        for (int k = n; k >= 0; k--)
          sum[j] = ((long long)sum[j] * sz[j] % mod + f[j][k]) % mod;
      } else {
        sum[j] = 0;
        memset(f[j], 0, sizeof f[j]);
      }
  }
  int ans = 0;
  for (int i = 0; i <= n * m - 1; i++) upd(ans, sum[i]);
  printf("%d\n", ans);
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 35;
const int B = 1000000;
const int mod = 998244353;
int n, m, invB;
int inv[N], a[N], sum[N * N], sz[N * N], p[N * N], f[N * N][N];
inline int ksm(int x, int p) {
  int ret = 1;
  for (; p; p >>= 1, x = (long long)x * x % mod)
    if (p & 1) ret = (long long)ret * x % mod;
  return ret;
}
inline void upd(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int get(int x) { return find(p, p + (n * m + 1), x) - p; }
int main() {
  inv[1] = 1;
  for (int i = 2; i < N; i++)
    inv[i] = (long long)inv[mod % i] * (mod - mod / i) % mod;
  invB = ksm(B, mod - 2);
  vector<int> v;
  v.push_back(0);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    double tmp;
    scanf("%lf", &tmp);
    a[i] = (int)(tmp * B + 0.5);
    v.push_back(a[i] % B);
  }
  sort((v).begin(), (v).end());
  v.erase(unique((v).begin(), (v).end()), v.end());
  m = (int)v.size();
  for (int i = n * m; i >= 0; i--) {
    p[i] = (i / m) * B + v[i % m];
    if (i < n * m) sz[i] = (long long)(p[i + 1] - p[i]) * invB % mod;
  }
  for (int i = min(m, get(a[0])) - 1; i >= 0; i--) {
    sum[i] = sz[i];
    f[i][1] = 1;
  }
  for (int i = 1; i < n; i++) {
    int cut = get(a[i]);
    for (int j = n * m - 1; j >= 0; j--)
      if (j < cut) {
        for (int k = max(0, j - m); k < j; k++) upd(f[j][0], sum[k]);
        if (j >= m)
          for (int k = 0; k <= n; k++) upd(f[j][k], mod - f[j - m][k]);
        for (int k = n - 1; k >= 0; k--)
          f[j][k + 1] = (long long)f[j][k] * inv[k + 1] % mod;
        f[j][0] = sum[j] = 0;
        for (int k = n; k >= 0; k--)
          sum[j] = ((long long)sum[j] * sz[j] % mod + f[j][k]) % mod;
      } else {
        sum[j] = 0;
        memset(f[j], 0, sizeof f[j]);
      }
  }
  int ans = 0;
  for (int i = 0; i <= n * m - 1; i++) upd(ans, sum[i]);
  printf("%d\n", ans);
  return 0;
}

```