#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 5;
int A[maxn], K[maxn], L[maxn], R[maxn];
double ans[maxn];
long long sum, C[maxn];
stack<pair<int, int>> st;
int read() {
  char c;
  int ans = 0;
  bool Sign = false;
  while (!isdigit(c = getchar()) && c != '-')
    ;
  if (c == '-') {
    Sign = true;
    c = getchar();
  }
  do {
    ans = ans * 10 + (c - '0');
  } while (isdigit(c = getchar()));
  return Sign ? -ans : ans;
}
int main() {
  int N = read();
  for (int i = 1; i <= N; i++) A[i] = read();
  int M = read();
  for (int i = 1; i <= M; i++) K[i] = read();
  st.push({0, 0});
  for (int i = 1; i <= N; i++) {
    while (st.top().first >= A[i]) st.pop();
    L[i] = i - st.top().second, st.push({A[i], i});
  }
  while (!st.empty()) st.pop();
  st.push({0, N + 1});
  for (int i = N; i >= 1; i--) {
    while (st.top().first > A[i]) st.pop();
    R[i] = st.top().second - i, st.push({A[i], i});
  }
  for (int i = 1; i <= N; i++) {
    C[1] += A[i], C[L[i] + 1] -= A[i], C[R[i] + 1] -= A[i],
        C[L[i] + R[i] + 1] += A[i];
  }
  for (int i = 1; i <= N; i++) {
    sum += (C[i] += C[i - 1]), ans[i] = 1.0 * sum / (N - i + 1);
  }
  for (int i = 1; i <= M; i++) printf("%.9f\n", ans[K[i]]);
}
