#include <bits/stdc++.h>
const int N = 31, mod = 998244353;
const int S = 1000000, T = 616898040;
int n, record[N * N];
int a[N], inv[N];
int b[N], cnt;
int c[N * N];
void up(int &x, int y) { x += y - mod, x += x >> 31 & mod; }
void down(int &x, int y) { x -= y, x += x >> 31 & mod; }
void integrate(std::vector<int> &p) {
  p.emplace_back(0);
  for (int i = (int)p.size() - 1; i; --i)
    p[i] = (long long)inv[i] * p[i - 1] % mod;
  p[0] = 0;
}
void operator-=(std::vector<int> &a, const std::vector<int> &b) {
  if (a.size() < b.size()) a.resize(b.size());
  for (int i = 0; i < (int)b.size(); ++i) down(a[i], b[i]);
}
int evaluation(const std::vector<int> &a, int x) {
  int ans = 0;
  for (int i = (int)a.size() - 1; ~i; --i)
    ans = ((long long)ans * x + a[i]) % mod;
  return ans;
}
std::vector<int> f[N * N];
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> n, inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = (long long)inv[mod % i] * (mod - mod / i) % mod;
  for (int i = 1; i <= n; ++i) {
    double x;
    std::cin >> x;
    a[i] = std::round(x * S);
    b[i] = a[i] % S;
  }
  b[0] = 0, std::sort(b, b + n + 1);
  cnt = std::unique(b, b + n + 1) - b;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < cnt; ++j) c[i * cnt + j] = b[j] + i * S;
  c[n * cnt] = n * S;
  for (int i = 1; i <= n; ++i)
    a[i] = std::lower_bound(c, c + n * cnt + 1, a[i]) - c;
  for (int i = 0; i < n * cnt; ++i)
    c[i] = (long long)(c[i + 1] - c[i] + mod) * T % mod;
  for (int i = 0; i < a[1] && i < cnt; ++i) f[i] = {1};
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j < a[i]; ++j)
      integrate(f[j]), record[j] = evaluation(f[j], c[j]);
    for (int j = a[i] - 1; ~j; --j) {
      for (int k = 1; k <= cnt && k <= j; ++k) up(f[j][0], record[j - k]);
      if (j >= cnt) f[j] -= f[j - cnt];
    }
    for (int j = a[i]; j < n * cnt; ++j) f[j].clear(), record[j] = 0;
  }
  int ans = 0;
  for (int i = 0; i < n * cnt; ++i) {
    integrate(f[i]);
    up(ans, evaluation(f[i], c[i]));
  }
  std::cout << ans << '\n';
  return 0;
}

### Prompt

Please create a solution in cpp 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 N = 31, mod = 998244353;
const int S = 1000000, T = 616898040;
int n, record[N * N];
int a[N], inv[N];
int b[N], cnt;
int c[N * N];
void up(int &x, int y) { x += y - mod, x += x >> 31 & mod; }
void down(int &x, int y) { x -= y, x += x >> 31 & mod; }
void integrate(std::vector<int> &p) {
  p.emplace_back(0);
  for (int i = (int)p.size() - 1; i; --i)
    p[i] = (long long)inv[i] * p[i - 1] % mod;
  p[0] = 0;
}
void operator-=(std::vector<int> &a, const std::vector<int> &b) {
  if (a.size() < b.size()) a.resize(b.size());
  for (int i = 0; i < (int)b.size(); ++i) down(a[i], b[i]);
}
int evaluation(const std::vector<int> &a, int x) {
  int ans = 0;
  for (int i = (int)a.size() - 1; ~i; --i)
    ans = ((long long)ans * x + a[i]) % mod;
  return ans;
}
std::vector<int> f[N * N];
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> n, inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = (long long)inv[mod % i] * (mod - mod / i) % mod;
  for (int i = 1; i <= n; ++i) {
    double x;
    std::cin >> x;
    a[i] = std::round(x * S);
    b[i] = a[i] % S;
  }
  b[0] = 0, std::sort(b, b + n + 1);
  cnt = std::unique(b, b + n + 1) - b;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < cnt; ++j) c[i * cnt + j] = b[j] + i * S;
  c[n * cnt] = n * S;
  for (int i = 1; i <= n; ++i)
    a[i] = std::lower_bound(c, c + n * cnt + 1, a[i]) - c;
  for (int i = 0; i < n * cnt; ++i)
    c[i] = (long long)(c[i + 1] - c[i] + mod) * T % mod;
  for (int i = 0; i < a[1] && i < cnt; ++i) f[i] = {1};
  for (int i = 2; i <= n; ++i) {
    for (int j = 0; j < a[i]; ++j)
      integrate(f[j]), record[j] = evaluation(f[j], c[j]);
    for (int j = a[i] - 1; ~j; --j) {
      for (int k = 1; k <= cnt && k <= j; ++k) up(f[j][0], record[j - k]);
      if (j >= cnt) f[j] -= f[j - cnt];
    }
    for (int j = a[i]; j < n * cnt; ++j) f[j].clear(), record[j] = 0;
  }
  int ans = 0;
  for (int i = 0; i < n * cnt; ++i) {
    integrate(f[i]);
    up(ans, evaluation(f[i], c[i]));
  }
  std::cout << ans << '\n';
  return 0;
}

```