#include <bits/stdc++.h>
using namespace std;
const int maxn = 35, P = 998244353, Q = 1000000;
int n, x[maxn], inv[maxn], C[maxn][maxn], px[maxn * maxn];
vector<int> a[maxn * maxn];
inline void inc(int &x, int y) {
  if ((x += y) >= P) x -= P;
}
inline void dec(int &x, int y) {
  if ((x -= y) < 0) x += P;
}
int qp(int x, int y) {
  int z = 1;
  for (; y; y >>= 1, x = 1LL * x * x % P) {
    if (y & 1) z = 1LL * z * x % P;
  }
  return z;
}
vector<int> integrate(vector<int> a) {
  vector<int> b = {0};
  for (int i = 0; i < a.size(); i++) {
    b.push_back(1LL * a[i] * inv[i + 1] % P);
  }
  return b;
}
void sub(vector<int> &a, vector<int> b) {
  while (a.size() < b.size()) a.push_back(0);
  for (int i = 0; i < b.size(); i++) {
    dec(a[i], b[i]);
  }
}
vector<int> shift(vector<int> a, int d) {
  vector<int> b(a.size()), pw = {1};
  for (int i = 0; i < a.size(); i++) {
    pw.push_back(1LL * d * pw.back() % P);
  }
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j <= i; j++) {
      inc(b[j], 1LL * a[i] * C[i][j] % P * pw[i - j] % P);
    }
  }
  return b;
}
int eval(vector<int> a, int x) {
  int ans = 0;
  for (int i = (int)a.size() - 1; ~i; i--) {
    ans = (1LL * ans * x + a[i]) % P;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) {
    inv[i] = qp(i, P - 2);
    for (int j = C[i][0] = 1; j <= i; j++) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
    }
  }
  vector<int> decimal = {0};
  for (int i = 0; i < n; i++) {
    double foo;
    scanf("%lf", &foo);
    x[i] = round(foo * Q);
    decimal.push_back(x[i] % Q);
  }
  sort(decimal.begin(), decimal.end());
  decimal.resize(unique(decimal.begin(), decimal.end()) - decimal.begin());
  int cnt = decimal.size();
  for (int i = 0; i <= cnt * n; i++) {
    px[i] = 1LL * (i / cnt * Q + decimal[i % cnt]) * qp(Q, P - 2) % P;
  }
  for (int i = 0; i < n; i++) {
    x[i] = 1LL * x[i] * qp(Q, P - 2) % P;
    for (int j = 0; j <= cnt * n; j++) {
      if (x[i] == px[j]) {
        x[i] = j;
        break;
      }
    }
  }
  for (int i = 0; i < cnt * n; i++) {
    a[i] = {i < min(cnt, x[0])};
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < cnt * n; j++) {
      a[j] = integrate(a[j]);
    }
    for (int j = cnt * n - 1; ~j; j--) {
      dec(a[j][0], eval(a[j], px[j]));
      for (int k = j - 1; k >= max(0, j - cnt); k--) {
        inc(a[j][0], eval(a[k], px[k + 1]));
        if (k > j - cnt)
          dec(a[j][0], eval(a[k], px[k]));
        else
          sub(a[j], shift(a[j - cnt], P - 1));
      }
    }
    for (int j = x[i]; j < cnt * n; j++) {
      a[j] = {0};
    }
  }
  int ans = 0;
  for (int i = 0; i < n * cnt; i++) {
    vector<int> b = integrate(a[i]);
    inc(ans, eval(b, px[i + 1]));
    dec(ans, eval(b, px[i]));
  }
  printf("%d\n", ans);
  return 0;
}
