#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int maxn = 150005;
inline int gi() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
  return sum;
}
int n;
struct node {
  int p, t;
  double l, r;
} t[maxn];
int main() {
  n = gi();
  for (int i = 1; i <= n; ++i) t[i].p = gi();
  long long T = 0;
  for (int i = 1; i <= n; ++i) T += (t[i].t = gi());
  sort(t + 1, t + n + 1, [](const node &a, const node &b) {
    return (long long)a.p * b.t > (long long)b.p * a.t;
  });
  long long s = 0;
  for (int i = 1, j = 1; i <= n; i = ++j) {
    while (j < n &&
           (long long)t[i].p * t[j + 1].t == (long long)t[j + 1].p * t[i].t)
      ++j;
    for (int k = i; k <= j; ++k) t[k].l = 1. * (s + t[k].t) * t[k].p / T;
    for (int k = i; k <= j; ++k) s += t[k].t;
    for (int k = i; k <= j; ++k) t[k].r = 1. * s * t[k].p / T;
  }
  sort(t + 1, t + n + 1,
       [](const node &a, const node &b) { return a.p < b.p; });
  double ans = 1;
  for (int i = 1, j; i <= n; ++i)
    if (t[i].p < t[i + 1].p) {
      double mn = 1e18, mx = 0;
      j = i;
      while (j && t[j].p == t[i].p) mn = min(mn, t[j--].l);
      j = i + 1;
      while (j <= n && t[j].p == t[i + 1].p) mx = max(mx, t[j++].r);
      if (mx - mn > eps) ans = min(ans, (t[i + 1].p - t[i].p) / (mx - mn));
    }
  printf("%.11lf", ans);
  return 0;
}
