#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long n, tmp;
double ans = 1.0;
struct node {
  long long p, t, l, r;
} a[N];
inline long long read() {
  long long 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 << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
bool cmp1(const node& a, const node& b) { return a.t * b.p < b.t * a.p; }
bool cmp2(const node& a, const node& b) { return a.p < b.p; }
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i].p = read();
  for (long long i = 1; i <= n; i++) a[i].t = read();
  sort(a + 1, a + n + 1, cmp1);
  for (long long i = 1, j; i <= n; i = j + 1) {
    for (j = i; j < n && a[j + 1].p * a[j].t == a[j].p * a[j + 1].t; j++)
      ;
    for (long long k = i; k <= j; k++) a[k].l = tmp + a[k].t;
    for (long long k = i; k <= j; k++) tmp += a[k].t;
    for (long long k = i; k <= j; k++) a[k].r = tmp;
  }
  sort(a + 1, a + n + 1, cmp2);
  for (long long i = 1, mn, mx; i < n; i++) {
    if (a[i].p == a[i + 1].p) continue;
    mn = tmp;
    mx = 0;
    for (long long j = i; a[j].p == a[i].p; j--) mn = min(mn, a[j].l);
    for (long long j = i + 1; a[j].p == a[i + 1].p; j++) mx = max(mx, a[j].r);
    double res = (double)tmp * (a[i + 1].p - a[i].p) /
                 ((double)mx * a[i + 1].p - (double)mn * a[i].p);
    if (res >= 1e-11) ans = min(ans, res);
  }
  printf("%.10f\n", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
