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>
constexpr int MOD = 998244353;
constexpr int inv(int x) {
  return x == 1 ? 1 : (MOD - MOD / x) * 1LL * inv(MOD % x) % MOD;
}
constexpr int B = 1000000;
constexpr int invB = inv(B);
constexpr int kN = 31;
constexpr int kW = kN * kN;
int n, m, bound[kN], values[kW], coef[kW][kN], sum[kW], size[kW];
int Inv[kN];
int find(int x) {
  return std::lower_bound(values, values + n * m + 1, x) - values;
}
inline void add(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
int main() {
  Inv[1] = 1;
  for (int i = 2; i < kN; ++i) Inv[i] = inv(i);
  scanf("%d", &n);
  std::vector<int> ss{0};
  for (int i = 0; i < n; ++i) {
    double x;
    scanf("%lf", &x);
    bound[i] = int(x * B + .5);
    ss.emplace_back(bound[i] % B);
  }
  std::sort(ss.begin(), ss.end());
  ss.erase(std::unique(ss.begin(), ss.end()), ss.end());
  m = ss.size();
  for (int i = n * m; i >= 0; --i) {
    values[i] = (i / m) * B + ss[i % m];
    if (i < n * m)
      size[i] = (values[i + 1] - values[i] + MOD) * 1LL * invB % MOD;
  }
  for (int i = std::min(find(bound[0]), m) - 1; i >= 0; --i) {
    sum[i] = size[i];
    coef[i][1] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int cut = find(bound[i]);
    for (int j = n * m - 1; j >= 0; --j) {
      if (j < cut) {
        for (int k = std::max(0, j - m); k < j; ++k) add(coef[j][0], sum[k]);
        if (j >= m)
          for (int k = 0; k <= n; ++k) add(coef[j][k], MOD - coef[j - m][k]);
        for (int k = n; k > 0; --k)
          coef[j][k] = coef[j][k - 1] * 1LL * Inv[k] % MOD;
        coef[j][0] = 0;
        sum[j] = 0;
        for (int k = n; k >= 0; --k)
          sum[j] = (sum[j] * 1LL * size[j] + coef[j][k]) % MOD;
      } else {
        std::fill(coef[j], coef[j] + kN, 0);
        sum[j] = 0;
      }
    }
  }
  int result = 0;
  for (int i = 0; i < n * m; ++i) add(result, sum[i]);
  printf("%d\n", result);
}