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 double eps = 1e-9;
const int mod = 998244353;
double x[33], xp[33];
struct pp {
  double vl;
  int zz;
  bool operator<(const pp &temp) const { return vl < temp.vl; }
};
pp sg[33][33 * 33 * 2];
pp now;
int cnt_sg[33];
int n, y[33], coef[33][33 * 33][33], nc[33], c[33][33], inv[33];
int power(int a, int n) {
  if (n == 0) return 1;
  int ret = power(a, n / 2);
  ret = 1LL * ret * ret % mod;
  if (n % 2) ret = 1LL * ret * a % mod;
  return ret;
}
int main() {
  scanf("%d", &n);
  int i, j, s, p, q;
  for (i = 0; i <= n; i++)
    for (j = 0; j <= i; j++) {
      if (j == 0 || j == i)
        c[i][j] = 1;
      else
        c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
    }
  for (i = 0; i < n; i++) {
    scanf("%lf", &x[i]);
    x[i] = min(i + 1., x[i]);
    if (i) x[i] = min(xp[i - 1] + 1, x[i]);
    xp[i] = x[i];
    long long mu = 1, zi = 0;
    long long zz = 0;
    while (true) {
      zi = (long long)(x[i] + 1e-7);
      zz = 1LL * zz * 10 + zi;
      x[i] = x[i] - zi;
      if (fabs(x[i]) < 1e-7) break;
      x[i] *= 10;
      mu *= 10;
    }
    zi = zz % mod;
    y[i] = 1LL * zi * power(mu % mod, mod - 2) % mod;
  }
  memset(cnt_sg, 0, sizeof(cnt_sg));
  sg[0][cnt_sg[0]].vl = sg[0][cnt_sg[0]].zz = 0;
  cnt_sg[0]++;
  sg[0][cnt_sg[0]].vl = xp[0];
  sg[0][cnt_sg[0]++].zz = y[0];
  sg[0][cnt_sg[0]].vl = sg[0][cnt_sg[0]].zz = 1;
  cnt_sg[0]++;
  memset(coef, 0, sizeof(coef));
  coef[0][0][0] = 1;
  for (i = 0; i <= n; i++) inv[i] = power(i, mod - 2);
  for (i = 0; i + 1 < n; i++) {
    cnt_sg[i + 1] = 0;
    for (j = 0; j <= n; j++) {
      for (s = -(int)(xp[j] + 1 - eps);; s++) {
        now.vl = xp[j] + s;
        if (now.vl < 0) {
          now.vl = 0;
          now.zz = 0;
        } else {
          now.zz = (y[j] + s) % mod;
          if (now.zz < 0) now.zz += mod;
        }
        if (now.vl >= xp[i + 1] + eps) break;
        sg[i + 1][cnt_sg[i + 1]++] = now;
      }
    }
    sort(sg[i + 1], sg[i + 1] + cnt_sg[i + 1]);
    int nn = 0;
    for (j = 0; j < cnt_sg[i + 1]; j++) {
      if (nn == 0 || sg[i + 1][nn - 1].zz != sg[i + 1][j].zz)
        sg[i + 1][nn++] = sg[i + 1][j];
    }
    cnt_sg[i + 1] = nn;
    s = 0;
    int us = 0;
    for (j = 0; j + 1 < cnt_sg[i + 1]; j++) {
      while (us < cnt_sg[i] && sg[i][us].vl <= sg[i + 1][j].vl - 1 + eps) us++;
      s = us;
      int bz;
      while (s < cnt_sg[i] && sg[i][s].vl <= sg[i + 1][j].vl + eps) {
        double ll, rr;
        int lz, rz;
        if (s == us) {
          for (p = 0; p <= i && s; p++) {
            int vc = 1LL * coef[i][s - 1][p] * inv[p + 1] % mod;
            for (q = 0; q <= p + 1; q++) {
              int bc = 1LL * vc * c[p + 1][q] % mod;
              if ((p + 1 - q) % 2)
                coef[i + 1][j][q] = (coef[i + 1][j][q] + bc) % mod;
              else
                coef[i + 1][j][q] = (coef[i + 1][j][q] - bc + mod) % mod;
            }
          }
        }
        bz = 0;
        for (p = i; p >= 0 && s; p--)
          bz = (1LL * bz * sg[i][s].zz + 1LL * coef[i][s - 1][p] * inv[p + 1]) %
               mod;
        coef[i + 1][j][0] = (coef[i + 1][j][0] + 1LL * bz * sg[i][s].zz) % mod;
        if (s > us) {
          bz = 0;
          for (p = i; p >= 0; p--)
            bz = (1LL * bz * sg[i][s - 1].zz +
                  1LL * coef[i][s - 1][p] * inv[p + 1]) %
                 mod;
          coef[i + 1][j][0] =
              (coef[i + 1][j][0] - 1LL * bz * sg[i][s - 1].zz % mod + mod) %
              mod;
        }
        s++;
      }
      if (s < cnt_sg[i]) {
        s--;
        bz = 0;
        for (p = i; p >= 0; p--)
          bz =
              (1LL * bz * sg[i][s].zz + 1LL * coef[i][s][p] * inv[p + 1]) % mod;
        coef[i + 1][j][0] =
            (coef[i + 1][j][0] - 1LL * bz * sg[i][s].zz % mod + mod) % mod;
        for (p = 0; p <= i; p++)
          coef[i + 1][j][p + 1] =
              (coef[i + 1][j][p + 1] +
               1LL * coef[i][s][p] * power(p + 1, mod - 2)) %
              mod;
      }
    }
  }
  int ans = 0;
  for (i = 0; i < cnt_sg[n - 1] - 1; i++) {
    int bz = 0, lz = sg[n - 1][i].zz, rz = sg[n - 1][i + 1].zz;
    for (j = n - 1; j >= 0; j--)
      bz = (1LL * bz * rz + 1LL * coef[n - 1][i][j] * inv[j + 1]) % mod;
    ans = (ans + 1LL * bz * rz) % mod;
    bz = 0;
    for (j = n - 1; j >= 0; j--)
      bz = (1LL * bz * lz + 1LL * coef[n - 1][i][j] * inv[j + 1]) % mod;
    ans = (ans - 1LL * bz * lz % mod + mod) % mod;
  }
  printf("%d\n", ans);
  return 0;
}