#include <bits/stdc++.h>
using namespace std;
const int mn = 1010000;
int a[mn], sa[mn], pre[mn], suc[mn];
long long g[mn], s[mn], now;
int n, m, i, j, L, R, Q;
char ch;
void read(int& v) {
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    ;
  v = ch - 48;
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    v = v * 10 + ch - 48;
}
bool cmp(int i, int j) { return a[i] > a[j]; }
int main() {
  read(n);
  for (i = 1; i <= n; ++i) read(a[i]), sa[i] = i;
  for (i = 0; i <= n; ++i) suc[pre[i + 1] = i] = i + 1;
  sort(sa + 1, sa + 1 + n, cmp);
  for (i = 1; i <= n; ++i) {
    j = sa[i];
    L = j - pre[j] - 1, R = suc[j] - j - 1;
    pre[suc[j]] = pre[j], suc[pre[j]] = suc[j];
    g[1] += a[j], g[L + 2] -= a[j];
    g[R + 2] -= a[j], g[L + R + 3] += a[j];
  }
  for (i = 1; i <= n; ++i) {
    now += g[i];
    s[i] = s[i - 1] + now;
  }
  read(Q);
  while (Q--) {
    read(i);
    printf("%.10lf\n", (double)s[i] / (n - i + 1));
  }
  return 0;
}
