#include <bits/stdc++.h>
using namespace std;
double eps = 1e-8;
const int N = 200005;
double ear[N], sum[N], lat[N];
double minn[N];
int n, pre[N];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
struct pro {
  int p, t, id;
  double now;
} a[N];
bool cmp(pro u, pro v) { return u.now > v.now; }
bool cmp2(pro u, pro v) { return u.p > v.p; }
bool check(double mid) {
  for (int i = 1; i <= n; i++) {
    double nw = a[i].p * (1 - ear[a[i].id] * mid / sum[n]);
    if (nw > minn[pre[i]]) return false;
    minn[i] = min(minn[i - 1], a[i].p * (1 - lat[a[i].id] * mid / sum[n]));
  }
  return true;
}
int main() {
  minn[0] = 0x3f3f3f3f;
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i].p = read();
  }
  for (int i = 1; i <= n; i++) {
    a[i].t = read();
    a[i].now = 1.0 * a[i].p / a[i].t;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i].t;
    a[i].id = i;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n + 1; j++) {
      if (a[j].now != a[i].now || j > n) {
        for (int k = i; k < j; k++) {
          ear[k] = sum[i - 1] + a[k].t;
          lat[k] = sum[j - 1];
        }
        i = j - 1;
        break;
      }
    }
  }
  sort(a + 1, a + n + 1, cmp2);
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n + 1; j++) {
      if (a[j].p != a[i].p || j > n) {
        for (int k = i; k < j; k++) {
          pre[k] = i - 1;
        }
        i = j - 1;
        break;
      }
    }
  }
  double l = 0, r = 1;
  while (r - l > eps) {
    double mid = (l + r) / 2;
    if (check(mid)) {
      l = mid;
    } else
      r = mid;
  }
  printf("%.6lf\n", l);
  return 0;
}
