#include <bits/stdc++.h>   using namespace std;   const int N = 150007;   const double eps = 1e-8;   int n;   double l, r, mid, sm[N], mxp[N], mnp[N];   struct note {     double p, t, c;     int id;   } a[N], b[N];   int cmp(note x, note y) { return x.c > y.c; }   int cmp0(note x, note y) { return x.p < y.p; }   int check() {     double mxv = 0;     for (int i = 1, j, lb, rb; i <= n; i = j) {       j = i;       while (j <= n && a[j].c == a[i].c) ++j;       lb = i, rb = j - 1;       for (int k = i; k < j; ++k) {         mnp[a[k].id] = a[k].p * (1 - mid * sm[rb] / sm[n]);         mxp[a[k].id] = a[k].p * (1 - mid * (sm[lb - 1] + a[k].t) / sm[n]);       }     }     for (int i = 1, j; i <= n; i = j) {       j = i;       while (j <= n && b[j].p == b[i].p) ++j;       for (int k = i; k < j; ++k)         if (mxv > mnp[b[k].id]) return 0;       for (int k = i; k < j; ++k) mxv = max(mxv, mxp[b[k].id]);     }     return 1;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %lf , &a[i].p), a[i].id = i;     for (int i = 1; i <= n; ++i) scanf( %lf , &a[i].t), a[i].c = a[i].p / a[i].t;     memcpy(b, a, sizeof(a));     sort(b + 1, b + n + 1, cmp0);     sort(a + 1, a + n + 1, cmp);     for (int i = 1; i <= n; ++i) sm[i] = sm[i - 1] + a[i].t;     l = 0, r = 1;     while (r - l > eps) {       mid = (l + r) / 2;       if (check())         l = mid;       else         r = mid;     }     printf( %.7lf n , l);     return 0;   }   