#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> p[1020304];
bool cmp(long long x, long long y) {
  return p[x].first + p[x].second < p[y].first + p[y].second;
}
long long n, m, dc[1020304], s[1020304], l[1020304], r[1020304], P[1020304],
    ans[1020304];
int a[1020304];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  long long t = 0;
  for (int i = 1; i <= n; ++i) {
    while (t && a[s[t]] > a[i]) --t;
    if (t)
      l[i] = s[t];
    else
      l[i] = 0;
    s[++t] = i;
  }
  t = 0;
  for (int i = n; i >= 1; --i) {
    while (t && a[s[t]] >= a[i]) --t;
    if (t)
      r[i] = s[t];
    else
      r[i] = n + 1;
    s[++t] = i;
  }
  for (int i = 1; i <= n; ++i) {
    p[i] = make_pair(r[i] - i, i - l[i]), P[i] = i;
    if (p[i].first > p[i].second) swap(p[i].first, p[i].second);
  }
  sort(P + 1, P + n + 1, cmp);
  long long pp = n;
  memset(dc, 0, sizeof(dc));
  long long nowdc = 0, now = 0;
  for (int i = n; i >= 1; --i) {
    while (p[P[pp]].first + p[P[pp]].second - 1 == i && pp) {
      now += a[P[pp]];
      nowdc -= a[P[pp]];
      dc[p[P[pp]].first] += a[P[pp]];
      dc[p[P[pp]].second] += a[P[pp]];
      pp--;
    }
    ans[i] = now;
    nowdc += dc[i];
    now -= nowdc;
  }
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    int t;
    scanf("%d", &t);
    printf("%.15lf\n", (double)ans[t] / (double)(n + 1 - t));
  }
  return 0;
}
