#include <bits/stdc++.h>
using namespace std;
long long n, m, ll[1000010], rr[1000010];
long long a[1000010], b[1000010], c[1000010];
double ans[1000010];
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 (register int i = 1; i <= n; ++i) a[i] = read();
  a[0] = a[n + 1] = -1e9;
  for (register int i = n; i >= 1; --i) {
    if (a[i] >= a[i + 1])
      rr[i] = i + 1;
    else
      for (register int j = rr[i + 1]; j <= n + 1; j = rr[j])
        if (a[i] >= a[j]) {
          rr[i] = j;
          break;
        }
  }
  for (register int i = 1; i <= n; ++i) {
    if (a[i] > a[i - 1])
      ll[i] = i - 1;
    else
      for (register int j = ll[i - 1]; j >= 0; j = ll[j])
        if (a[i] > a[j]) {
          ll[i] = j;
          break;
        }
  }
  for (register int i = 1; i <= n; i++) {
    ll[i] = i - ll[i];
    rr[i] = rr[i] - i;
  }
  for (register int i = 1; i <= n; i++) {
    int x = ll[i], y = rr[i];
    if (x > y) swap(x, y);
    c[1] += a[i], c[x + 1] -= a[i];
    b[x + 1] += a[i] * x, b[y + 1] -= a[i] * x;
    b[y + 1] += a[i] * (x + y), b[x + y] -= a[i] * (x + y);
    c[y + 1] -= a[i], c[x + y] += a[i];
  }
  long long c1 = 0, c2 = 0;
  for (register int i = 1; i <= n; ++i)
    c1 += c[i], c2 += b[i],
        ans[i] = (double)(c1 * i + c2) / (double)(n - i + 1);
  m = read();
  while (m--) {
    int i = read();
    printf("%.9lf\n", ans[i]);
  }
  return 0;
}
