#include <bits/stdc++.h>
const int M = 998244353;
int n, m;
long long inv[70];
long long w[2000000];
long long x[2000000];
long long f[4000][70];
long long val[2000000];
long long point[2000000];
long long sum[2000000];
long long pow_mod(long long x, long long p, long long M) {
  long long ans = 1;
  long long tmp = x;
  while (p) {
    if (p & 1) {
      ans = ans * tmp % M;
    }
    tmp = tmp * tmp % M;
    p >>= 1;
  }
  return ans;
}
int calc(int x) {
  return std::lower_bound(point, point + n * m + 1, x) - point;
}
int main() {
  inv[1] = 1;
  for (int i = 2; i <= 60; i++) {
    inv[i] = pow_mod(i, M - 2, M);
  }
  scanf("%d", &n);
  m++;
  w[m] = 0;
  for (int i = 0; i < n; i++) {
    double xx;
    scanf("%lf", &xx);
    x[i] = (int)(xx * 1000000 + 0.01);
    m++;
    w[m] = x[i] % 1000000;
  }
  std::sort(w + 1, w + m + 1);
  m = std::unique(w + 1, w + m + 1) - w;
  long long invI = pow_mod(1000000, M - 2, M);
  for (int i = n * m; i >= 0; i--) {
    point[i] = (i / m) * 1000000 + w[i % m];
    if (i < n * m) {
      val[i] = (long long)(point[i + 1] - point[i]) * invI % M;
    }
  }
  for (int i = std::min(calc(x[0]), m) - 1; i >= 0; i--) {
    sum[i] = val[i];
    f[i][1] = 1;
  }
  for (int i = 1; i < n; i++) {
    int cut = calc(x[i]);
    for (int j = n * m - 1; j >= 0; j--) {
      if (j < cut) {
        for (int k = std::max(0, j - m); k < j; k++) {
          f[j][0] = (f[j][0] + sum[k]) % M;
        }
        if (j >= m) {
          for (int k = 0; k <= n; k++) {
            f[j][k] = (f[j][k] - f[j - m][k] + M) % M;
          }
        }
        for (int k = n - 1; k >= 0; k--) {
          f[j][k + 1] = f[j][k] * inv[k + 1] % M;
        }
        f[j][0] = sum[j] = 0;
        for (int k = n; k >= 0; k--) {
          sum[j] = (sum[j] * val[j] + f[j][k]) % M;
        }
      } else {
        sum[j] = 0;
        memset(f[j], 0, sizeof(f[j]));
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < n * m; i++) {
    ans = (ans + sum[i]) % M;
  }
  printf("%lld\n", ans);
  return 0;
}

### Prompt

Generate a cpp solution to the following 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.

### Response

```cpp
#include <bits/stdc++.h>
const int M = 998244353;
int n, m;
long long inv[70];
long long w[2000000];
long long x[2000000];
long long f[4000][70];
long long val[2000000];
long long point[2000000];
long long sum[2000000];
long long pow_mod(long long x, long long p, long long M) {
  long long ans = 1;
  long long tmp = x;
  while (p) {
    if (p & 1) {
      ans = ans * tmp % M;
    }
    tmp = tmp * tmp % M;
    p >>= 1;
  }
  return ans;
}
int calc(int x) {
  return std::lower_bound(point, point + n * m + 1, x) - point;
}
int main() {
  inv[1] = 1;
  for (int i = 2; i <= 60; i++) {
    inv[i] = pow_mod(i, M - 2, M);
  }
  scanf("%d", &n);
  m++;
  w[m] = 0;
  for (int i = 0; i < n; i++) {
    double xx;
    scanf("%lf", &xx);
    x[i] = (int)(xx * 1000000 + 0.01);
    m++;
    w[m] = x[i] % 1000000;
  }
  std::sort(w + 1, w + m + 1);
  m = std::unique(w + 1, w + m + 1) - w;
  long long invI = pow_mod(1000000, M - 2, M);
  for (int i = n * m; i >= 0; i--) {
    point[i] = (i / m) * 1000000 + w[i % m];
    if (i < n * m) {
      val[i] = (long long)(point[i + 1] - point[i]) * invI % M;
    }
  }
  for (int i = std::min(calc(x[0]), m) - 1; i >= 0; i--) {
    sum[i] = val[i];
    f[i][1] = 1;
  }
  for (int i = 1; i < n; i++) {
    int cut = calc(x[i]);
    for (int j = n * m - 1; j >= 0; j--) {
      if (j < cut) {
        for (int k = std::max(0, j - m); k < j; k++) {
          f[j][0] = (f[j][0] + sum[k]) % M;
        }
        if (j >= m) {
          for (int k = 0; k <= n; k++) {
            f[j][k] = (f[j][k] - f[j - m][k] + M) % M;
          }
        }
        for (int k = n - 1; k >= 0; k--) {
          f[j][k + 1] = f[j][k] * inv[k + 1] % M;
        }
        f[j][0] = sum[j] = 0;
        for (int k = n; k >= 0; k--) {
          sum[j] = (sum[j] * val[j] + f[j][k]) % M;
        }
      } else {
        sum[j] = 0;
        memset(f[j], 0, sizeof(f[j]));
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < n * m; i++) {
    ans = (ans + sum[i]) % M;
  }
  printf("%lld\n", ans);
  return 0;
}

```