#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n) >= 1) {
    vector<int> a(n);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    vector<int> left(n);
    vector<int> st(n);
    for (int i = 0, r = 0; i < n; i++) {
      while (r && a[st[r - 1]] >= a[i]) r--;
      left[i] = r ? st[r - 1] : -1;
      st[r++] = i;
    }
    vector<int> right(n);
    for (int i = n - 1, r = 0; i >= 0; i--) {
      while (r && a[st[r - 1]] > a[i]) r--;
      right[i] = r ? st[r - 1] : n;
      st[r++] = i;
    }
    vector<long long> pla(n + 2, 0), plb(n + 2, 0);
    for (int i = 0; i < n; i++) {
      pla[0] += a[i];
      pla[i - left[i]] -= a[i];
      plb[i - left[i]] += (long long)a[i] * (i - left[i]);
      pla[right[i] - i] -= a[i];
      plb[right[i] - i] += (long long)a[i] * (right[i] - i);
      pla[right[i] - left[i]] += a[i];
      plb[right[i] - left[i]] -= (long long)a[i] * (right[i] - left[i]);
    }
    vector<long long> res(n, 0);
    long long A = 0, B = 0;
    for (int i = 0; i <= n; i++) {
      A += pla[i], B += plb[i];
      if (i) res[i - 1] = A * i + B;
    }
    int m;
    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
      int k;
      scanf("%d", &k);
      printf("%.18lf\n", res[k - 1] / (n - k + 1.0));
    }
  }
  return 0;
}
