#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
int n, a[N];
long long f[N], w[N];
int rmq[N][22], lg[N];
pair<int, int> q[N * 2];
int gmin(int l, int r) {
  int d = lg[r - l + 1];
  int &x = rmq[l][d], &y = rmq[r - (1 << d) + 1][d];
  if (a[x] <= a[y]) return x;
  return y;
}
int main() {
  cin >> n;
  for (int i = (1); i <= (n); i++) scanf("%d", a + i), rmq[i][0] = i;
  for (int i = 1, p = 0; i <= n; i++) {
    if ((1 << (p + 1)) == i) p++;
    lg[i] = p;
  }
  for (int d = (1); d <= (lg[n]); d++)
    for (int i = (1); i <= (n); i++)
      if (i + (1 << d) - 1 > n)
        break;
      else {
        int &x = rmq[i][d - 1], &y = rmq[i + (1 << (d - 1))][d - 1];
        if (a[x] <= a[y])
          rmq[i][d] = x;
        else
          rmq[i][d] = y;
      }
  q[1] = make_pair(1, n);
  for (int head = 1, tail = 1; head <= tail; head++) {
    int l = q[head].first, r = q[head].second, x = gmin(l, r);
    if (l < x) q[++tail] = make_pair(l, x - 1);
    if (x < r) q[++tail] = make_pair(x + 1, r);
    l = x - l;
    r = r - x;
    if (l > r) swap(l, r);
    for (int i = (0); i <= (l); i++) {
      w[(i + 1)] += a[x];
      w[(i + 1 + r) + 1] -= a[x];
    }
  }
  for (int i = (1); i <= (n); i++) f[i] = f[i - 1] + w[i];
  int Q;
  cin >> Q;
  while (Q--) {
    int x;
    scanf("%d", &x);
    printf("%.9lf\n", f[x] / (n - x + 1.0));
  }
  return 0;
}
