#include <bits/stdc++.h>
using namespace std;
const int N = 31, mod = 998244353, B = 1e6, IB = 616898040;
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) return a = b, 1;
  return 0;
}
void qmo(int &x) { x += x >> 31 & mod; }
int n, m, a[N], inv[N], val[N * N], len[N * N], sum[N * N], coe[N * N][N], ans;
vector<int> cut;
double x;
int id(int x) { return lower_bound(val, val + n * m + 1, x) - val; }
int main() {
  scanf("%d", &n);
  inv[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = mod - (long long)mod / i * inv[mod % i] % mod;
  for (int i = 0; i < n; ++i) {
    scanf("%lf", &x);
    a[i] = (int)(x * B + 0.5);
    chmin(a[i], (i + 1) * B);
    cut.emplace_back(a[i] % B);
  }
  cut.emplace_back(0);
  sort(cut.begin(), cut.end());
  cut.erase(unique(cut.begin(), cut.end()), cut.end());
  m = cut.size();
  for (int i = n * m; ~i; --i) val[i] = i / m * B + cut[i % m];
  for (int i = n * m - 1; ~i; --i)
    len[i] = ((long long)val[i + 1] - val[i]) * IB % mod;
  for (int i = id(a[0]) - 1; ~i; --i) {
    sum[i] = len[i];
    coe[i][1] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int _ = id(a[i]);
    for (int j = _; j < (i + 1) * m; ++j) {
      memset(coe[j], 0, n + 1 << 2);
      sum[j] = 0;
    }
    for (int j = _ - 1; ~j; --j) {
      for (int k = j - 1; ~k && k >= j - m; --k) qmo(coe[j][0] += sum[k] - mod);
      if (j >= m)
        for (int k = 1; k <= i; ++k) qmo(coe[j][k] -= coe[j - m][k]);
      for (int k = i + 1; k; --k)
        coe[j][k] = (long long)coe[j][k - 1] * inv[k] % mod;
      coe[j][0] = sum[j] = 0;
      for (int k = i + 1; ~k; --k)
        sum[j] = ((long long)sum[j] * len[j] + coe[j][k]) % mod;
    }
  }
  for (int i = 0; i < n * m; ++i) qmo(ans += sum[i] - mod);
  printf("%d\n", ans);
}
