#include <bits/stdc++.h>
const int N = 31;
const int B = 1000000;
const int INV_B = 616898040;
const int MOD = 998244353;
int inv[N], n, m, a[N], values[N * N], size[N * N], sum[N * N], coef[N * N][N];
int find(int a) { return std::find(values, values + (n * m + 1), a) - values; }
void update(int& x, int a) {
  x += a;
  if (x >= MOD) {
    x -= MOD;
  }
}
int main() {
  inv[1] = 1;
  for (int i = 2; i < N; ++i) {
    inv[i] = 1LL * (MOD - MOD / i) * inv[MOD % i] % MOD;
  }
  scanf("%d", &n);
  std::vector<int> fractions{0};
  for (int i = 0; i < n; ++i) {
    double x;
    scanf("%lf", &x);
    a[i] = (int)(x * B + 0.5);
    fractions.push_back(a[i] % B);
  }
  std::sort((fractions).begin(), (fractions).end());
  fractions.erase(std::unique((fractions).begin(), (fractions).end()),
                  fractions.end());
  m = fractions.size();
  for (int i = n * m; i >= 0; --i) {
    values[i] = (i / m) * B + fractions[i % m];
    if (i < n * m) {
      size[i] = 1LL * (values[i + 1] - values[i]) * INV_B % MOD;
    }
  }
  for (int i = std::min(find(a[0]), m) - 1; i >= 0; --i) {
    sum[i] = size[i];
    coef[i][1] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int cut = find(a[i]);
    for (int j = n * m - 1; j >= 0; --j) {
      if (j < cut) {
        for (int k = j - 1; k >= 0 && k >= j - m; --k) {
          update(coef[j][0], sum[k]);
        }
        if (j >= m) {
          for (int k = 0; k <= n; ++k) {
            update(coef[j][k], MOD - coef[j - m][k]);
          }
        }
        for (int k = n - 1; k >= 0; --k) {
          coef[j][k + 1] = 1LL * coef[j][k] * inv[k + 1] % MOD;
        }
        coef[j][0] = 0;
        sum[j] = 0;
        for (int k = n; k >= 0; --k) {
          sum[j] = (1LL * sum[j] * size[j] + coef[j][k]) % MOD;
        }
      } else {
        sum[j] = 0;
        memset(coef[j], 0, sizeof(coef[j]));
      }
    }
  }
  int result = 0;
  for (int j = 0; j < n * m; ++j) {
    update(result, sum[j]);
  }
  printf("%d\n", result);
}

### Prompt

In cpp, your task is to solve 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;
const int B = 1000000;
const int INV_B = 616898040;
const int MOD = 998244353;
int inv[N], n, m, a[N], values[N * N], size[N * N], sum[N * N], coef[N * N][N];
int find(int a) { return std::find(values, values + (n * m + 1), a) - values; }
void update(int& x, int a) {
  x += a;
  if (x >= MOD) {
    x -= MOD;
  }
}
int main() {
  inv[1] = 1;
  for (int i = 2; i < N; ++i) {
    inv[i] = 1LL * (MOD - MOD / i) * inv[MOD % i] % MOD;
  }
  scanf("%d", &n);
  std::vector<int> fractions{0};
  for (int i = 0; i < n; ++i) {
    double x;
    scanf("%lf", &x);
    a[i] = (int)(x * B + 0.5);
    fractions.push_back(a[i] % B);
  }
  std::sort((fractions).begin(), (fractions).end());
  fractions.erase(std::unique((fractions).begin(), (fractions).end()),
                  fractions.end());
  m = fractions.size();
  for (int i = n * m; i >= 0; --i) {
    values[i] = (i / m) * B + fractions[i % m];
    if (i < n * m) {
      size[i] = 1LL * (values[i + 1] - values[i]) * INV_B % MOD;
    }
  }
  for (int i = std::min(find(a[0]), m) - 1; i >= 0; --i) {
    sum[i] = size[i];
    coef[i][1] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int cut = find(a[i]);
    for (int j = n * m - 1; j >= 0; --j) {
      if (j < cut) {
        for (int k = j - 1; k >= 0 && k >= j - m; --k) {
          update(coef[j][0], sum[k]);
        }
        if (j >= m) {
          for (int k = 0; k <= n; ++k) {
            update(coef[j][k], MOD - coef[j - m][k]);
          }
        }
        for (int k = n - 1; k >= 0; --k) {
          coef[j][k + 1] = 1LL * coef[j][k] * inv[k + 1] % MOD;
        }
        coef[j][0] = 0;
        sum[j] = 0;
        for (int k = n; k >= 0; --k) {
          sum[j] = (1LL * sum[j] * size[j] + coef[j][k]) % MOD;
        }
      } else {
        sum[j] = 0;
        memset(coef[j], 0, sizeof(coef[j]));
      }
    }
  }
  int result = 0;
  for (int j = 0; j < n * m; ++j) {
    update(result, sum[j]);
  }
  printf("%d\n", result);
}

```