#include <bits/stdc++.h>
using namespace std;
struct node {
  int p, t;
  long long minn, maxx;
} a[150005];
int n, m, t[150005], bl[150005];
long long b[150005], T;
double l, r, mid, minv[150005], maxv[150005];
inline bool cmp(const node &x, const node &y) {
  return (long long)x.t * y.p < (long long)y.t * x.p;
}
inline bool cmp2(const node &x, const node &y) { return x.p < y.p; }
inline bool check(double c) {
  for (int i = 1; i <= m; ++i) {
    minv[i] = 1e18;
    maxv[i] = -1e18;
  }
  for (int i = 1; i <= n; ++i) {
    maxv[bl[i]] = max(maxv[bl[i]], a[i].p * (1.0 - c * a[i].minn / T));
    minv[bl[i]] = min(minv[bl[i]], a[i].p * (1.0 - c * a[i].maxx / T));
  }
  for (int i = 1; i < m; ++i)
    if (maxv[i] > minv[i + 1]) return 0;
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i].p);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i].t);
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; ++i) {
    t[i] = a[i].t;
    b[i] = b[i - 1] + t[i];
  }
  T = b[n];
  for (int i = 1, j = 1, k = 1; i <= n; ++i) {
    while (j <= n && (long long)a[j].t * a[i].p < (long long)a[i].t * a[j].p)
      ++j;
    while (k <= n && (long long)a[k].t * a[i].p <= (long long)a[i].t * a[k].p)
      ++k;
    a[i].minn = b[j - 1] + a[i].t;
    a[i].maxx = b[k - 1];
  }
  sort(a + 1, a + 1 + n, cmp2);
  for (int i = 1, j = 0; i <= n; ++i) {
    if (a[i].p != a[i - 1].p) ++j;
    bl[i] = j;
  }
  m = bl[n];
  l = 0.0;
  r = 1.0;
  while (r - l >= 1e-7) {
    mid = (l + r) * 0.5;
    check(mid) ? l = mid : r = mid;
  }
  printf("%.11lf\n", l);
  return 0;
}
