#include #include #include #include #include #include #include #include #include #include #include #include #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) #define repeat_from(i,m,n) for (int i = (m); (i) < (n); ++(i)) #define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i)) #define repeat_from_reverse(i,m,n) for (int i = (n)-1; (i) >= (m); --(i)) #define whole(f,x,...) ([&](decltype((x)) y) { return (f)(begin(y), end(y), ## __VA_ARGS__); })(x) typedef long long ll; using namespace std; template void setmax(T & a, T const & b) { if (a < b) a = b; } template void setmin(T & a, T const & b) { if (b < a) a = b; } template auto vectors(T a, X x) { return vector(x, a); } template auto vectors(T a, X x, Y y, Zs... zs) { auto cont = vectors(a, y, zs...); return vector(x, cont); } int main() { // input int n; scanf("%d", &n); vector p(n); repeat (i,n) scanf("%d", &p[i]); vector q(n); repeat (i,n) scanf("%d", &q[i]); // compute vector r(n); repeat (i,n) r[i] = (p[i] / 1000.) * (q[i] / 100.); auto cmp = [&](int i, int j) { return r[i] < r[j]; }; priority_queue, decltype(cmp)> que(cmp); repeat (i,n) que.push(i); long double ans = 0; const long double eps = 1e-16; for (int k = 1; ; ++ k) { int i = que.top(); que.pop(); if (r[i] < eps) break; ans += k * r[i]; r[i] *= 1 - q[i] / 100.; que.push(i); } // output printf("%.6Lf\n", ans); return 0; }