import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { auto n = readln.chomp.to!size_t; auto pi = readln.split.to!(real[]).map!"a / 1000".array; auto qi = readln.split.to!(real[]).map!"a / 100".array; auto r = real(0), s = real(1); foreach (_; 0..100000) { auto i = n.iota.map!(j => pi[j] * qi[j]).maxIndex, p = pi[i], q = qi[i]; foreach (j; 0..n) { if (i == j) pi[j] = p * (1 - q) / (1 - p * q); else pi[j] /= 1 - p * q; } r += (p * q + 1) * s; s *= (1 - p * q); if (s < 1e-9) break; } writefln("%.4f", r - 1); }