// ~~ icebear love attttttt ~~
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
template<class T>
bool minimize(T &a, const T &b) {
if (a > b) return a = b, true;
return false;
}
template<class T>
bool maximize(T &a, const T &b) {
if (a < b) return a = b, true;
return false;
}
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORR(i,a,b) for(int i=(a); i>=(b); --i)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define RED(i, n) for(int i=(n)-1; i>=0; --i)
#define MASK(i) (1LL << (i))
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define task "rider"
const int MOD = 1e9 + 7;
const int inf = 1e9 + 27092008;
const ll INF = 1e18 + 27092008;
const int N = 2e5 + 5;
int numFest, numQuery;
pair<ll, int> endFest[N];
struct Line {
double a, b; // a * x + b
int id;
Line (double _a = 0, double _b = 0, int _id = 0):
a(_a), b(_b), id(_id) {}
double calc(ll x) {
return a * x + b;
}
Line operator - (const Line &L) {
return Line(a - L.a, b - L.b, 0);
}
};
class ConvexHullTrick {
private:
bool useless(Line L1, Line L2, Line L3) {
L3 = L3 - L2;
L2 = L2 - L1;
return (L2.a * L3.b - L3.a * L2.b) >= 0;
}
deque<Line> hull;
public:
void addLine(const Line &newLine) {
while(hull.size() >= 2 && useless(hull[hull.size() - 2], hull.back(), newLine))
hull.pop_back();
hull.pb(newLine);
}
double getMax(ll s) {
int l = 0, r = (int)hull.size() - 1, mid = 0;
while(l <= r) {
mid = (l + r) >> 1;
if (mid == 0 || mid == (int)hull.size() - 1) break;
if (hull[mid - 1].calc(s) > hull[mid].calc(s)) r = mid - 1;
else if (hull[mid + 1].calc(s) > hull[mid].calc(s)) l = mid + 1;
else break;
}
return 1.0 * (endFest[hull[mid].id].se) / (endFest[hull[mid].id].fi - s);
}
} CHT;
void init(void) {
cin >> numFest;
FOR(i, 1, numFest) cin >> endFest[i].fi, endFest[i].se = i;
sort(endFest + 1, endFest + numFest + 1);
vector<Line> lines;
FOR(i, 1, numFest) lines.pb(Line(-1.0 / endFest[i].se, 1.0 * endFest[i].fi / endFest[i].se, i));
sort(all(lines), [&](const Line &l1, const Line &l2){
return l1.a < l2.a;
});
for(auto l : lines) CHT.addLine(l);
}
void process(void) {
cin >> numQuery;
while(numQuery--) {
int timeStart;
cin >> timeStart;
cout << fixed << setprecision(12) << CHT.getMax(timeStart) << '\n';
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int tc = 1;
// cin >> tc;
while(tc--) {
init();
process();
}
return 0;
}
Ly8gfn4gaWNlYmVhciBsb3ZlIGF0dHR0dHR0IH5+CiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgcGFpcjxpbnQsIGludD4gaWk7CnR5cGVkZWYgcGFpcjxpbnQsIGlpPiBpaWk7Cgp0ZW1wbGF0ZTxjbGFzcyBUPgogICAgYm9vbCBtaW5pbWl6ZShUICZhLCBjb25zdCBUICZiKSB7CiAgICAgICAgaWYgKGEgPiBiKSByZXR1cm4gYSA9IGIsIHRydWU7CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfQoKdGVtcGxhdGU8Y2xhc3MgVD4KICAgIGJvb2wgbWF4aW1pemUoVCAmYSwgY29uc3QgVCAmYikgewogICAgICAgIGlmIChhIDwgYikgcmV0dXJuIGEgPSBiLCB0cnVlOwogICAgICAgIHJldHVybiBmYWxzZTsKICAgIH0KCiNkZWZpbmUgRk9SKGksYSxiKSBmb3IoaW50IGk9KGEpOyBpPD0oYik7ICsraSkKI2RlZmluZSBGT1JSKGksYSxiKSBmb3IoaW50IGk9KGEpOyBpPj0oYik7IC0taSkKI2RlZmluZSBSRVAoaSwgbikgZm9yKGludCBpPT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iBMMy5iIC0gTDMuYSAqIEwyLmIpID49IDA7CiAgICB9CgogICAgZGVxdWU8TGluZT4gaHVsbDsKcHVibGljOgogICAgdm9pZCBhZGRMaW5lKGNvbnN0IExpbmUgJm5ld0xpbmUpIHsKICAgICAgICB3aGlsZShodWxsLnNpemUoKSA+PSAyICYmIHVzZWxlc3MoaHVsbFtodWxsLnNpemUoKSAtIDJdLCBodWxsLmJhY2soKSwgbmV3TGluZSkpCiAgICAgICAgICAgIGh1bGwucG9wX2JhY2soKTsKICAgICAgICBodWxsLnBiKG5ld0xpbmUpOwogICAgfQoKICAgIGRvdWJsZSBnZXRNYXgobGwgcykgewogICAgICAgIGludCBsID0gMCwgciA9IChpbnQpaHVsbC5zaXplKCkgLSAxLCBtaWQgPSAwOwogICAgICAgIHdoaWxlKGwgPD0gcikgewogICAgICAgICAgICBtaWQgPSAobCArIHIpID4+IDE7CiAgICAgICAgICAgIGlmIChtaWQgPT0gMCB8fCBtaWQgPT0gKGludClodWxsLnNpemUoKSAtIDEpIGJyZWFrOwogICAgICAgICAgICBpZiAoaHVsbFttaWQgLSAxXS5jYWxjKHMpID4gaHVsbFttaWRdLmNhbGMocykpIHIgPSBtaWQgLSAxOwogICAgICAgICAgICBlbHNlIGlmIChodWxsW21pZCArIDFdLmNhbGMocykgPiBodWxsW21pZF0uY2FsYyhzKSkgbCA9IG1pZCArIDE7CiAgICAgICAgICAgIGVsc2UgYnJlYWs7CiAgICAgICAgfQogICAgICAgIHJldHVybiAxLjAgKiAoZW5kRmVzdFtodWxsW21pZF0uaWRdLnNlKSAvIChlbmRGZXN0W2h1bGxbbWlkXS5pZF0uZmkgLSBzKTsKICAgIH0KfSBDSFQ7Cgp2b2lkIGluaXQodm9pZCkgewogICAgY2luID4+IG51bUZlc3Q7CiAgICBGT1IoaSwgMSwgbnVtRmVzdCkgY2luID4+IGVuZEZlc3RbaV0uZmksIGVuZEZlc3RbaV0uc2UgPSBpOwogICAgc29ydChlbmRGZXN0ICsgMSwgZ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