#include <bits/stdc++.h>
using namespace std;
const int MXN = 1000003;
int N, Q;
int a[MXN];
int q[MXN], top = 0;
int l[MXN], r[MXN];
long long s[MXN];
double ans[MXN] = {};
void solve() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d", a + i);
  for (int i = 1; i <= N; i++) {
    while (top && a[q[top]] >= a[i]) {
      r[q[top]] = i - 1;
      top--;
    }
    l[i] = q[top] + 1;
    q[++top] = i;
  }
  while (top) r[q[top--]] = N;
  for (int i = 1; i <= N; i++) {
    s[r[i] - i] -= a[i];
    s[i - l[i]] -= a[i];
    s[r[i] - l[i] + 1] += a[i];
  }
  for (int i = 1; i <= N; i++) ans[i] = s[i];
  for (int i = N; i >= 1; i--) ans[i] += ans[i + 1];
  for (int i = N; i >= 1; i--) ans[i] += ans[i + 1];
  for (int k = 1; k <= N; k++) ans[k] /= N - k + 1;
  scanf("%d", &Q);
  int k;
  while (Q--) {
    scanf("%d", &k);
    printf("%.15lf\n", ans[k]);
  }
}
int main() {
  solve();
  return 0;
}
