#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1e9 + 7;
const int N = 1e6 + 5, M = 1e5 + 10, NM1 = N - 1;
long long int OO = 1e18 + 8;
int oo = 1e9 + 8;
void readFile() {}
int n, m, l, r, x, top, arr[N], st[N];
long long int sum[N];
int main() {
  readFile();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", arr + i);
  for (int i = 1; i <= n + 1; i++) {
    while (arr[i] < arr[st[top]]) {
      l = st[top] - st[top - 1];
      r = i - st[top];
      sum[1] += x = arr[st[top--]];
      sum[l + 1] -= x;
      sum[r + 1] -= x;
      sum[l + r + 1] += x;
    }
    st[++top] = i;
  }
  for (int i = 1; i <= n; i++) sum[i] += sum[i - 1];
  for (int i = 1; i <= n; i++) sum[i] += sum[i - 1];
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &x);
    printf("%0.12f\n", (double)sum[x] / (n - x + 1.0));
  }
  return 0;
}
