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;
const int mod = 998244353;
const int INF = int(1e9);
int n;
int inv[maxn], binom[maxn][maxn];
int power(int x, int pow) {
  int res = 1;
  for (; pow; pow >>= 1) {
    if (pow & 1) res = 1LL * res * x % mod;
    x = 1LL * x * x % mod;
  }
  return res;
}
class Poly {
 public:
  vector<int> v;
  Poly() { v.clear(); }
  Poly(int _v) {
    v.clear();
    v.push_back(_v);
  }
  int calc(int x) {
    int cur = 1, res = 0;
    for (int i = 0; i < int(v.size()); i++) {
      res = (res + 1LL * cur * v[i]) % mod;
      cur = 1LL * cur * x % mod;
    }
    return res;
  }
  Poly shift(int d) {
    d = mod - d;
    Poly res;
    res.v.resize(int(v.size()), 0);
    int cur = 1;
    for (int i = 0; i < int(v.size()); i++) {
      for (int j = 0; i + j < int(v.size()); j++)
        res.v[j] =
            (res.v[j] + 1LL * cur * binom[i + j][i] % mod * v[i + j]) % mod;
      cur = 1LL * cur * d % mod;
    }
    return res;
  }
  Poly intg() {
    Poly res;
    if (v.empty()) return res;
    res.v.resize(int(v.size()) + 1, 0);
    for (int i = 0; i < int(v.size()); i++)
      res.v[i + 1] = 1LL * v[i] * inv[i + 1] % mod;
    return res;
  }
  Poly operator-(const Poly &o) const {
    Poly res;
    res.v.resize(max(int(v.size()), int(o.v.size())));
    for (int i = 0; i < int(res.v.size()); i++)
      res.v[i] = ((i < int(v.size()) ? v[i] : 0) + mod -
                  (i < int(o.v.size()) ? o.v[i] : 0)) %
                 mod;
    return res;
  }
  void operator*=(const int &o) {
    for (int i = 0; i < int(v.size()); i++) v[i] = 1LL * v[i] * o % mod;
  }
};
class Func {
 public:
  vector<int> pos;
  vector<Poly> func;
  void init() {
    pos.push_back(0);
    func.push_back(Poly(0));
    pos.push_back(INF);
    func.push_back(Poly(1));
  }
  void integral(int d) {
    int iv = power(d, mod - 2);
    for (int i = 0; i < int(pos.size()); i++) {
      func[i] = func[i].intg();
      if (i)
        func[i] = func[i] - Poly((func[i].calc(pos[i - 1]) + mod -
                                  func[i - 1].calc(pos[i - 1])) %
                                 mod);
    }
    vector<int> npos;
    vector<Poly> nfunc;
    for (int i = 0; i < int(pos.size()); i++) {
      npos.push_back(pos[i]);
      if (pos[i] != INF) npos.push_back(pos[i] + d);
    }
    sort(npos.begin(), npos.end());
    npos.resize(unique(npos.begin(), npos.end()) - npos.begin());
    for (int i = 0; i < int(npos.size()); i++) {
      int pr = lower_bound(pos.begin(), pos.end(), npos[i]) - pos.begin();
      int pl = lower_bound(pos.begin(), pos.end(), npos[i] - d) - pos.begin();
      nfunc.push_back(func[pr] - func[pl].shift(d));
      nfunc.back() *= iv;
    }
    pos = npos;
    func = nfunc;
  }
  void cut(int d) {
    while (int(pos.size()) > 1 && pos[int(pos.size()) - 2] >= d)
      pos.pop_back(), func.pop_back();
    pos.back() = d;
    int cur = func.back().calc(d);
    pos.push_back(INF);
    func.push_back(Poly(cur));
  }
} F;
int main() {
  scanf("%d", &n);
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= n + 1; i++)
    inv[i] = 1LL * inv[mod % i] * (mod - mod / i) % mod;
  binom[0][0] = 1;
  for (int i = 1; i <= n + 1; i++) {
    binom[i][0] = binom[i][i] = 1;
    for (int j = 1; j < i; j++)
      binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % mod;
  }
  F.init();
  for (int i = 1; i <= n; i++) {
    double x;
    scanf("%lf", &x);
    F.integral(1000000);
    F.cut(int(x * 1000000 + 0.5));
  }
  printf("%d\n", F.func.back().v[0]);
  return 0;
}