#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int h[maxn], st[maxn], l[maxn];
long long ans[maxn];
int main() {
  int n, m, top, i, r, x;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d", h + i);
  for (i = 1, top = 0; i <= n; ++i) {
    while (top && h[st[top]] > h[i]) --top;
    l[i] = top ? st[top] : 0;
    st[++top] = i;
  }
  for (i = n, top = 0; i >= 1; --i) {
    while (top && h[st[top]] >= h[i]) --top;
    r = top ? st[top] : n + 1;
    st[++top] = i;
    ans[1] += h[i];
    ans[i - l[i] + 1] -= h[i];
    ans[r - i + 1] -= h[i];
    ans[r - l[i] + 1] += h[i];
  }
  for (i = 1; i <= n; ++i) ans[i] += ans[i - 1];
  for (i = 1; i <= n; ++i) ans[i] += ans[i - 1];
  scanf("%d", &m);
  while (m--) {
    scanf("%d", &x);
    printf("%.12lf\n", ans[x] / (double)(n - x + 1));
  }
  return 0;
}
