#include <bits/stdc++.h>
using namespace std;
const int N(1000010);
int n, m, i;
int fa[N], a[N], s[N], le[N], ri[N];
long long c1[N], c2[N];
bool bo[N];
void add(long long *c, int l, int r, long long t) {
  l = max(l, 0);
  r = min(r, n - 1);
  if (l > r) return;
  t *= a[i];
  c[l] += t;
  c[r + 1] -= t;
}
void update(int a, int b) {
  int l, r;
  l = 0;
  r = min(i - a, b - i) - 1;
  add(c1, l, r, 1);
  add(c2, l, r, 1);
  l = i - a;
  r = b - i - 1;
  add(c1, l, r, i - a + 1);
  l = max(i - a, b - i);
  r = b - a + 1;
  add(c1, l, r, b - a + 1);
  add(c2, l, r, -1);
  l = b - i;
  r = i - a - 1;
  add(c1, l, r, b - i + 1);
}
bool cmp(int x, int y) { return a[x] > a[y]; }
int find(int x) { return fa[x] != -1 ? fa[x] = find(fa[x]) : x; }
int main() {
  cin >> n;
  for (int k = int(0); k < int(n); ++k) {
    cin >> a[k];
    s[k] = k;
  }
  memset(fa, -1, sizeof(fa));
  sort(s, s + n, cmp);
  for (int k = int(0); k < int(n); ++k) {
    if (s[k] == 0) {
      i = s[k];
    }
    i = s[k];
    le[i] = ri[i] = i;
    if (i && bo[i - 1]) {
      le[i] = le[find(i - 1)];
      fa[find(i - 1)] = i;
    }
    if (i + 1 < n && bo[i + 1]) {
      ri[i] = ri[find(i + 1)];
      fa[find(i + 1)] = i;
    }
    update(le[i], ri[i]);
    bo[i] = true;
  }
  for (int k = int(1); k < int(n); ++k) {
    c1[k] += c1[k - 1];
    c2[k] += c2[k - 1];
  }
  cout.precision(10);
  for (cin >> m; m; --m) {
    int k;
    cin >> k;
    --k;
    cout << (k * c2[k] + c1[k]) / (double)(n - k) << endl;
  }
  return 0;
}
