#include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) typedef long long ll; using namespace std; int inputValue(){ int a; cin >> a; return a; }; template void output(T a, int precision) { if(precision > 0){ cout << fixed << setprecision(precision) << a << "\n"; } else{ cout << a << "\n"; } } int main() { // source code int N = inputValue(); vector P(N), Q(N); rep(i, N){ P[i] = (double)inputValue() / 1000.0; } rep(i, N){ Q[i] = (double)inputValue() / 100.0; } priority_queue pq; vector R(N); rep(j, N){ R[j] = P[j] * Q[j]; pq.push(R[j]); } rep(i, 1000){ rep(j, N){ pq.push(R[j] * (1 - Q[j])); R[j] = R[j] * (1 - Q[j]); } } int cnt = 1; double ret = 0; while (!pq.empty()) { double t = pq.top(); pq.pop(); ret += t * cnt; cnt++; } output(ret, 5); return 0; }