#include <bits/stdc++.h>
using namespace std;
template <typename T>
__inline T Tmin(T p, T q) {
  return p < q ? p : q;
}
template <typename T>
__inline T Tmax(T p, T q) {
  return p > q ? p : q;
}
template <typename T>
__inline T Tsum(T p, T q) {
  return p + q;
}
template <typename T>
class SMTree {
 public:
  int tree_n;
  T *tree;
  T initvalue;
  T (*func)(T p, T q);
  void del(void) { delete tree; }
  void init(int _n) {
    tree_n = 1;
    while (tree_n < _n) tree_n <<= 1;
    tree = new T[tree_n * 2 + 1];
    for (int i = 0; i <= tree_n * 2; i++) tree[i] = initvalue;
  }
  void init(int _n, T (*_func)(T p, T q)) {
    func = _func;
    init(_n);
  }
  void init(int _n, T (*_func)(T p, T q), T _initvalue) {
    initvalue = _initvalue;
    func = _func;
    init(_n);
  }
  T query(int node, int ql, int qr, int l, int r) {
    if (ql > r || qr < l)
      return initvalue;
    else if (ql <= l && qr >= r)
      return tree[node];
    return func(query(node * 2, ql, qr, l, (l + r) / 2),
                query(node * 2 + 1, ql, qr, (l + r) / 2 + 1, r));
  }
  T query(int l, int r) { return query(1, l, r, 1, tree_n); }
  void set(int pos, T k) {
    int node = pos + tree_n - 1;
    tree[node] = k;
    while (node > 1) {
      node >>= 1;
      tree[node] = func(tree[node * 2], tree[node * 2 + 1]);
    }
  }
  void set(int pos) { set(pos, initvalue); }
  void add(int pos, T k) {
    int node = pos + tree_n - 1;
    set(pos, tree[node] + k);
  }
};
int n, m;
pair<int, int> a[1000005];
SMTree<int> minT, maxT;
SMTree<double> sumT1, sumT2;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i].first);
    a[i].second = i + 1;
  }
  sort(a, a + n);
  minT.init(n + 2, Tmin, 2140000000);
  maxT.init(n + 2, Tmax, 0);
  sumT1.init(n + 2, Tsum, 0.0);
  sumT2.init(n + 2, Tsum, 0.0);
  for (int i = 0; i < n; i++) {
    int left = maxT.query(1, a[i].second - 1);
    int right = minT.query(a[i].second + 1, n + 1);
    if (right == 2140000000) right = n + 1;
    minT.set(a[i].second, a[i].second);
    maxT.set(a[i].second, a[i].second);
    int l1 = min(a[i].second - left, right - a[i].second) + 1;
    int l2 = right - left - l1 + 1;
    int l3 = right - left;
    sumT1.add(1, (double)a[i].first);
    sumT1.add(l1, -(double)a[i].first);
    sumT2.add(l1, (double)(l1 - 1) * a[i].first);
    sumT2.add(l2, -(double)(l1 - 1) * a[i].first);
    sumT1.add(l2, -(double)a[i].first);
    sumT1.add(l3, (double)a[i].first);
    sumT2.add(l2, (double)l3 * a[i].first);
    sumT2.add(l3, -(double)l3 * a[i].first);
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int q;
    scanf("%d", &q);
    double ans = 0.0;
    ans = sumT1.query(1, q) * q / (n - q + 1);
    ans += sumT2.query(1, q) / (n - q + 1);
    printf("%.11lf\n", ans);
  }
  return 0;
}
