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; real e(real[] pi, int count) { if (count == 0) return 1; 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; } return p * q + (1 - p * q) * e(pi, count - 1) + 1; } writefln("%.4f", e(pi, 1000) - 1); }