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 maxn = 35, P = 998244353, Q = 1000000;
int n, x[maxn], inv[maxn], C[maxn][maxn], px[maxn * maxn];
vector<int> a[maxn * maxn];
inline void inc(int &x, int y) {
  if ((x += y) >= P) x -= P;
}
inline void dec(int &x, int y) {
  if ((x -= y) < 0) x += P;
}
int qp(int x, int y) {
  int z = 1;
  for (; y; y >>= 1, x = 1LL * x * x % P) {
    if (y & 1) z = 1LL * z * x % P;
  }
  return z;
}
vector<int> integrate(vector<int> a) {
  vector<int> b = {0};
  for (int i = 0; i < a.size(); i++) {
    b.push_back(1LL * a[i] * inv[i + 1] % P);
  }
  return b;
}
void sub(vector<int> &a, vector<int> b) {
  while (a.size() < b.size()) a.push_back(0);
  for (int i = 0; i < b.size(); i++) {
    dec(a[i], b[i]);
  }
}
vector<int> shift(vector<int> a) {
  vector<int> b(a.size());
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j <= i; j++) {
      inc(b[j], 1LL * a[i] * C[i][j] % P * ((i - j) & 1 ? P - 1 : 1) % P);
    }
  }
  return b;
}
int eval(vector<int> a, int x) {
  int ans = 0;
  for (int i = (int)a.size() - 1; ~i; i--) {
    ans = (1LL * ans * x + a[i]) % P;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) {
    inv[i] = qp(i, P - 2);
    for (int j = C[i][0] = 1; j <= i; j++) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
    }
  }
  vector<int> decimal = {0};
  for (int i = 0; i < n; i++) {
    double foo;
    scanf("%lf", &foo);
    x[i] = round(foo * Q);
    decimal.push_back(x[i] % Q);
  }
  sort(decimal.begin(), decimal.end());
  decimal.resize(unique(decimal.begin(), decimal.end()) - decimal.begin());
  int cnt = decimal.size();
  for (int i = 0; i <= cnt * n; i++) {
    px[i] = 1LL * (i / cnt * Q + decimal[i % cnt]) * qp(Q, P - 2) % P;
  }
  for (int i = 0; i < n; i++) {
    x[i] = 1LL * x[i] * qp(Q, P - 2) % P;
    for (int j = 0; j <= cnt * n; j++) {
      if (x[i] == px[j]) {
        x[i] = j;
        break;
      }
    }
  }
  for (int i = 0; i < cnt * n; i++) {
    a[i] = {i < min(cnt, x[0])};
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < cnt * n; j++) {
      a[j] = integrate(a[j]);
    }
    for (int j = cnt * n - 1; ~j; j--) {
      dec(a[j][0], eval(a[j], px[j]));
      for (int k = j - 1; k >= max(0, j - cnt); k--) {
        inc(a[j][0], eval(a[k], px[k + 1]));
        if (k > j - cnt)
          dec(a[j][0], eval(a[k], px[k]));
        else
          sub(a[j], shift(a[j - cnt]));
      }
    }
    for (int j = x[i]; j < cnt * n; j++) {
      a[j] = {0};
    }
  }
  int ans = 0;
  for (int i = 0; i < n * cnt; i++) {
    vector<int> b = integrate(a[i]);
    inc(ans, eval(b, px[i + 1]));
    dec(ans, eval(b, px[i]));
  }
  printf("%d\n", ans);
  return 0;
}