#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000 + 10;
int a[MAXN], b[MAXN], L[MAXN], R[MAXN];
int n, m;
long long f[MAXN], g[MAXN];
bool cmp(int x, int y) {
  if (a[x] > a[y]) return true;
  return false;
}
void ins(int x, int t) { f[x] += (long long)t; }
int main() {
  int i, x, l, r;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) b[i] = i;
  sort(b + 1, b + n + 1, cmp);
  for (i = 0; i <= n + 1; i++) {
    R[i] = i + 1;
    L[i] = i - 1;
  }
  for (i = 1; i <= n; i++) {
    x = b[i];
    l = L[x];
    r = R[x];
    R[L[x]] = R[x];
    L[R[x]] = L[x];
    ins(r - x + 1 - 2, -a[x]);
    ins(x - l + 1 - 2, -a[x]);
    ins(r - l + 1 - 2, a[x]);
  }
  g[n] = f[n];
  for (i = n - 1; i >= 1; i--) {
    f[i] += f[i + 1];
    g[i] = g[i + 1] + f[i];
  }
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &x);
    printf("%.15lf\n", (double)g[x] / (double)(n - x + 1));
  }
  return 0;
}
