#include <bits/stdc++.h>
using namespace std;
class TestProctoring
{
public:
double expectedTime (vector <int> p, vector <int> q)
{
int n = (int) (p.size ());
int m = 1 << n;
vector <double> w (n);
for (int i = 0; i < n; i++)
{
w[i] = p[i];
w[i] /= q[i];
}
double res = 0.0;
for (int s = 1; s < m; s++)
{
double v = 0.0;
double sign = -1.0;
for (int i = 0; i < n; i++)
{
if (s & (1 << i))
{
v = v + w[i] - v * w[i];
sign *= -1.0;
}
}
res += sign * 1.0 / v;
}
return res;
}
};
int main ()
{
TestProctoring a;
vector <int> t0 = { 2, 3, 5, 7, 11, 13, 17};
vector <int> t1 = { 3, 5, 7, 11, 13, 17, 19};
printf ("%.20f\n", a.expectedTime (t0, t1));
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgVGVzdFByb2N0b3JpbmcKewpwdWJsaWM6Cglkb3VibGUgZXhwZWN0ZWRUaW1lICh2ZWN0b3IgPGludD4gcCwgdmVjdG9yIDxpbnQ+IHEpCgl7CgkJaW50IG4gPSAoaW50KSAocC5zaXplICgpKTsKCQlpbnQgbSA9IDEgPDwgbjsKCQl2ZWN0b3IgPGRvdWJsZT4gdyAobik7CgkJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspCgkJewoJCQl3W2ldID0gcFtpXTsKCQkJd1tpXSAvPSBxW2ldOwoJCX0KCQlkb3VibGUgcmVzID0gMC4wOwoJCWZvciAoaW50IHMgPSAxOyBzIDwgbTsgcysrKQoJCXsKCQkJZG91YmxlIHYgPSAwLjA7CgkJCWRvdWJsZSBzaWduID0gLTEuMDsKCQkJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspCgkJCXsKCQkJCWlmIChzICYgKDEgPDwgaSkpCgkJCQl7CgkJCQkJdiA9IHYgKyB3W2ldIC0gdiAqIHdbaV07CgkJCQkJc2lnbiAqPSAtMS4wOwoJCQkJfQoJCQl9CgkJCXJlcy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