#include <bits/stdc++.h>
using namespace std;
long long up[1000005], down[1000005], ping[1000005];
long long lzu[1000005], lzd[1000005];
long long n, m, a[1000005], l[1000005], r[1000005];
long long top, zhan[1000005];
int read() {
  char aa = getchar();
  int pp = 1, kk = 0;
  while (aa < '0' || aa > '9') {
    if (aa == '-') pp = -1;
    aa = getchar();
  }
  while (aa >= '0' && aa <= '9') {
    kk = kk * 10 + aa - '0';
    aa = getchar();
  }
  return kk * pp;
}
void write(int z) {
  if (z < 0) {
    putchar('-');
    z = -z;
  }
  if (z >= 10) {
    write(z / 10);
  }
  putchar(z % 10 + '0');
}
int main() {
  n = read();
  for (long long i = 1; i <= n; ++i) a[i] = read();
  a[0] = -0x3f3f3f3f;
  top = 0;
  zhan[0] = 0;
  for (long long i = 1; i <= n; ++i) {
    while (top && a[zhan[top]] >= a[i]) top--;
    l[i] = zhan[top] + 1;
    zhan[++top] = i;
  }
  top = 0;
  zhan[0] = n + 1;
  for (long long i = n; i >= 1; --i) {
    while (top && a[zhan[top]] > a[i]) top--;
    r[i] = zhan[top] - 1;
    zhan[++top] = i;
  }
  for (long long i = 1; i <= n; ++i) {
    long long mn = min(i - l[i] + 1, r[i] - i + 1),
              mx = max(i - l[i] + 1, r[i] - i + 1);
    if (mn + 1 <= mx - 1) ping[mn + 1] += a[i] * mn, ping[mx] -= a[i] * mn;
    lzu[1] += a[i];
    lzu[mn + 1] -= a[i];
    lzd[mx] += a[i];
    lzd[r[i] - l[i] + 2] -= a[i];
    up[mn + 1] -= a[i] * mn;
    down[mx] += a[i] * mn;
    if (mx == mn) ping[mn] -= a[i] * mn, ping[mn + 1] += a[i] * mn;
  }
  long long addu = 0, addd = 0;
  for (long long i = 1; i <= n; ++i) {
    ping[i] += ping[i - 1];
    addu += lzu[i];
    up[i] += up[i - 1] + addu;
    down[i] += down[i - 1] - addd;
    addd += lzd[i];
  }
  m = read();
  while (m--) {
    long long x = read();
    double sum = up[x] + down[x] + ping[x];
    printf("%.15lf\n", sum / (double)(n - x + 1.));
  }
  return 0;
}
