#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010, inf = 2000000000;
int n;
int val[maxn], L[maxn], R[maxn];
long long sum[maxn], xx[maxn];
void solve(void) {
  vector<int> st;
  st.push_back(0);
  for (int i = 1; i <= n; i++) {
    while (val[st.back()] > val[i]) {
      st.pop_back();
    }
    L[i] = st.back();
    st.push_back(i);
  }
  st.clear();
  st.push_back(n + 1);
  for (int i = n; i >= 1; i--) {
    while (val[st.back()] >= val[i]) {
      st.pop_back();
    }
    R[i] = st.back();
    st.push_back(i);
  }
  for (int x = 1; x <= n; x++) {
    int i = min(x - L[x], R[x] - x), len = R[x] - L[x] - 1;
    xx[1] += val[x];
    xx[1 + i] -= val[x];
    xx[len + 2 - i] -= val[x];
    xx[len + 2] += val[x];
  }
  long long x = 0, cur = 0;
  for (int i = 1; i <= n; i++) {
    x += xx[i];
    cur += x;
    sum[i] = cur;
  }
}
int main(void) {
  long long A = clock(), B, C, D;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &val[i]);
  }
  val[0] = -1;
  val[n + 1] = -1;
  B = clock();
  fprintf(stderr, "begin solve()\n");
  solve();
  fprintf(stderr, "finish solve()\n");
  C = clock();
  int qn;
  scanf("%d", &qn);
  for (int i = 0; i < qn; i++) {
    int q;
    scanf("%d", &q);
    int d = (n - q + 1);
    long long x = sum[q] / d;
    printf("%I64d.", x);
    int rem = sum[q] - d * x;
    for (int i = 0; i < 10; i++) {
      rem *= 10;
      int c = rem / d;
      putchar(c + '0');
      rem -= c * d;
    }
    putchar(' ');
  }
  D = clock();
  return 0;
}
