#include <bits/stdc++.h>
using namespace std;
long long n, m, R[1000100], a[1000100], k, x, L[1001000], y, C1, C2;
long long c1[1001000], c2[1001000];
double ans[1001000];
inline long long read() {
  long long cnt = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    cnt = cnt * 10 + ch - 48;
    ch = getchar();
  }
  return cnt * f;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  a[n + 1] = -((long long)1 << 60);
  a[0] = -((long long)1 << 60);
  for (int i = n; i; i--) {
    if (a[i + 1] <= a[i])
      R[i] = i + 1;
    else
      for (int j = R[i + 1]; j <= n + 1; j = R[j])
        if (a[j] <= a[i]) {
          R[i] = j;
          break;
        }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i - 1] < a[i])
      L[i] = i - 1;
    else
      for (int j = L[i - 1]; j >= 0; j = L[j])
        if (a[j] < a[i]) {
          L[i] = j;
          break;
        }
  }
  for (int i = 1; i <= n; i++) {
    L[i] = i - L[i];
    R[i] = R[i] - i;
  }
  for (int i = 1; i <= n; i++) {
    x = L[i];
    y = R[i];
    if (x > y) swap(x, y);
    c1[1] += a[i];
    c1[x + 1] -= a[i];
    c2[x + 1] += a[i] * x;
    c2[y + 1] -= a[i] * x;
    c2[y + 1] += a[i] * (x + y);
    c2[x + y] -= a[i] * (x + y);
    c1[y + 1] -= a[i];
    c1[x + y] += a[i];
  }
  for (int i = 1; i <= n; i++) {
    C1 += c1[i];
    C2 += c2[i];
    ans[i] = ((C1 * i + C2) * 1.0) / ((n - i + 1) * 1.0);
  }
  m = read();
  for (int i = 1; i <= m; i++) {
    k = read();
    printf("%.9lf\n", ans[k]);
  }
  return 0;
}
