#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void input(T &x) {
  register char c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline long long bigmod(long long p, long long e, long long M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
const int N = 1e6 + 6;
double Ans[N];
int a[N];
long long L[N], R[N];
int lazy[5 * N];
double T[5 * N], P[5 * N];
int n;
double brute(int w) {
  multiset<int> s;
  for (int i = 1; i < w; i++) s.insert(a[i]);
  double cnt = 0, sum = 0;
  for (int i = w; i <= n; i++) {
    s.insert(a[i]);
    cnt++;
    sum += *s.begin();
    s.erase(s.find(a[i - w + 1]));
  }
  return sum / cnt;
}
void upd(int n, int b, int e, int i, int j, double k, double s) {
  if (lazy[n]) {
    if (b != e) {
      lazy[((n) << 1)] = 1;
      lazy[((n) << 1 | 1)] = 1;
      T[((n) << 1)] += T[n];
      T[((n) << 1 | 1)] += T[n];
      P[((n) << 1)] += P[n];
      P[((n) << 1 | 1)] += P[n];
      lazy[n] = 0;
      T[n] = 0;
      P[n] = 0;
    }
  }
  if (b > j || e < i) return;
  if (b >= i && e <= j) {
    T[n] += k;
    P[n] += s;
    lazy[n] = 1;
    return;
  }
  int mid = (b + e) / 2;
  upd(((n) << 1), b, mid, i, j, k, s);
  upd(((n) << 1 | 1), mid + 1, e, i, j, k, s);
}
void Trv(int n, int b, int e) {
  if (lazy[n]) {
    if (b != e) {
      lazy[((n) << 1)] = 1;
      lazy[((n) << 1 | 1)] = 1;
      T[((n) << 1)] += T[n];
      T[((n) << 1 | 1)] += T[n];
      P[((n) << 1)] += P[n];
      P[((n) << 1 | 1)] += P[n];
      lazy[n] = 0;
      T[n] = 0;
      P[n] = 0;
    }
  }
  if (b == e) {
    Ans[b] = P[n] + b * T[n];
    return;
  }
  int mid = (b + e) / 2;
  Trv(((n) << 1), b, mid);
  Trv(((n) << 1 | 1), mid + 1, e);
}
int main() {
  input(n);
  for (int i = 1; i <= n; i++) input(a[i]);
  for (int i = 1; i <= n; i++) {
    int j = i - 1;
    while (j > 0 && a[j] >= a[i]) j = L[j];
    L[i] = j;
  }
  for (int i = n; i >= 1; i--) {
    int j = i + 1;
    while (j <= n && a[j] > a[i]) j = R[j];
    R[i] = j;
  }
  for (int i = 1; i <= n; i++) {
    long long x = i - L[i], y = R[i] - i;
    if (x > y) swap(x, y);
    upd(1, 1, n, 1, x, a[i], 0);
    upd(1, 1, n, x + 1, y, 0, x * a[i]);
    upd(1, 1, n, y + 1, x + y - 1, -a[i], (x + y) * a[i]);
  }
  Trv(1, 1, n);
  int q, k;
  input(q);
  for (int i = 1; i <= q; i++) {
    input(k);
    printf("%.12lf\n", Ans[k] / (n - k + 1));
  }
  return 0;
}
