#include <bits/stdc++.h>
using namespace std;
namespace {
template <class free>
inline void read(free& x) {
  x ^= x;
  register char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
}
template <class f1, class... f2>
inline void read(f1& x, f2&... y) {
  read(x), read(y...);
}
template <class free>
inline void Max(free& x, const free& y) {
  x = x < y ? y : x;
}
}  // namespace
struct data {
  int a, t;
  long long mn, mx;
  inline bool operator<(const data& x) const {
    return a * 1ll * x.t > x.a * 1ll * t;
  }
} d[200050];
inline bool comp(const data&, const data&);
int main() {
  int n;
  read(n);
  for (int i(1); i <= n; ++i) read(d[i].a);
  for (int i(1); i <= n; ++i) read(d[i].t);
  sort(d + 1, d + n + 1);
  long long b1(0);
  {
    for (int i(1), j, k; i <= n; i = j) {
      for (j = i; j <= n && d[i].a * 1ll * d[j].t == d[j].a * 1ll * d[i].t; ++j)
        ;
      for (k = i; k < j; ++k) d[k].mn = b1 + d[k].t;
      for (k = i; k < j; ++k) b1 += d[k].t;
      for (k = i; k < j; ++k) d[k].mx = b1;
    }
  }
  sort(d + 1, d + n + 1, comp);
  long double l(0), mid, r(1);
  while (mid = (l + r) / 2, l < r - 1e-11) {
    long double i1(0);
    int i, j, k;
    for (i = 1; i <= n; i = j) {
      for (j = i; j <= n && d[j].a == d[i].a; ++j)
        ;
      for (k = i; k < j; ++k)
        if (d[k].a * (1 - mid * d[k].mx / b1) < i1 - 1e-11) break;
      if (k < j) break;
      for (k = i; k < j; ++k) Max(i1, d[k].a * (1 - mid * d[k].mn / b1));
    }
    i <= n ? r = mid : l = mid;
  }
  return printf("%.9Lf", l), 0;
}
inline bool comp(const data& a, const data& b) { return a.a < b.a; }
