#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1100000;
namespace BCJ {
long long f[MAXN], siz[MAXN];
void init(long long n) {
  for (long long i = 1; i <= n; i++) f[i] = i, siz[i] = 1;
}
long long find(long long x) { return f[x] == x ? x : f[x] = find(f[x]); }
void merge(long long x, long long y) {
  long long fx = find(x), fy = find(y);
  if (fx == fy) return;
  f[fx] = fy;
  siz[fy] += siz[fx];
}
long long getsize(long long x) { return siz[find(x)]; }
}  // namespace BCJ
long long n, m;
long long num[MAXN], s[MAXN], vis[MAXN];
long long c1[MAXN], c2[MAXN], ans[MAXN];
bool cmp(long long a, long long b) { return num[a] > num[b]; }
void init() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &num[i]);
  }
  BCJ::init(n);
}
void addc(long long x, long long v, long long val) {
  if (x == 0) return;
  c1[1] += v * x * val;
  c2[1] -= v * 1 * val, c2[x + 1] += v * 1 * val;
}
void calc() {
  for (long long i = 1; i <= n; i++) s[i] = i;
  sort(s + 1, s + n + 1, cmp);
  for (long long i = 1; i <= n; i++) {
    long long t = s[i];
    vis[t] = 1;
    long long L = 0, R = 0;
    if (vis[t - 1]) L = BCJ::getsize(t - 1), BCJ::merge(t, t - 1);
    if (vis[t + 1]) R = BCJ::getsize(t + 1), BCJ::merge(t, t + 1);
    addc(L + R + 1, 1, num[t]), addc(L, -1, num[t]), addc(R, -1, num[t]);
  }
}
void solve() {
  for (long long i = 1; i <= n; i++) c2[i] = c2[i - 1] + c2[i];
  for (long long i = 1; i <= n; i++) c2[i] = c2[i - 1] + c2[i];
  for (long long i = 1; i <= n; i++) c1[i] = c1[i - 1] + c1[i];
  ans[1] = c1[1];
  for (long long i = 1; i <= n; i++) ans[i + 1] = c1[i] + c2[i];
  scanf("%lld", &m);
  for (long long i = 1; i <= m; i++) {
    long long t;
    scanf("%lld", &t);
    printf("%.10lf\n", double(ans[t]) / (n - t + 1));
  }
}
signed main() {
  init();
  calc();
  solve();
  return 0;
}
