#include <bits/stdc++.h>
using namespace std;
int a[1000005], l[1000005];
long long g[1000005], s[1000005];
int main() {
  int n, m, x;
  scanf("%d", &n);
  vector<int> u = {0};
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    while (a[i] < a[u.back()]) u.pop_back();
    l[i] = u.back();
    u.push_back(i);
  }
  u = {n + 1};
  for (int i = n; i >= 1; i--) {
    while (a[i] <= a[u.back()]) u.pop_back();
    int o = min(i - l[i], u.back() - i);
    int s = u.back() - l[i] + 1;
    g[1] += a[i];
    g[o + 1] -= a[i];
    g[s - o] -= a[i];
    g[s] += a[i];
    u.push_back(i);
  }
  long long spd = 0;
  for (int i = 1; i <= n; i++) {
    spd += g[i];
    s[i] = s[i - 1] + spd;
  }
  scanf("%d", &m);
  while (m--) {
    scanf("%d", &x);
    printf("%.16f\n", s[x] / (n - x + 1.0));
  }
}
