#include <bits/stdc++.h>
using namespace std;
struct P {
  long long point, time;
  long long pre, suf;
};
template <typename I>
inline constexpr int sgn(I&& x) {
  return (x > 0) - (x < 0);
}
inline int comp(P const& a, P const& b) {
  return sgn(a.point * b.time - b.point * a.time);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<P> v(n);
  for (auto& p : v) cin >> p.point;
  for (auto& p : v) cin >> p.time;
  sort(v.begin(), v.end(),
       [](P const& a, P const& b) { return comp(a, b) == 1; });
  long long Ts = v[0].pre = v[0].time;
  for (int i = 1; i < n; ++i) {
    Ts += v[i].time;
    v[i].pre =
        (comp(v[i - 1], v[i]) == 0 ? v[i - 1].pre - v[i - 1].time + v[i].time
                                   : Ts);
  }
  long long T = v[n - 1].suf = Ts;
  for (int i = n - 2; i >= 0; --i) {
    Ts -= v[i + 1].time;
    v[i].suf = (comp(v[i], v[i + 1]) == 0 ? v[i + 1].suf : Ts);
  }
  sort(v.begin(), v.end(),
       [](P const& a, P const& b) { return a.point < b.point; });
  auto check = [&](double c) {
    double S = 0.0, pS;
    for (int i = 0; i < n; ++i) {
      if (!i || v[i - 1].point != v[i].point) pS = S;
      double aS = v[i].point * (1.0 - c * v[i].suf / T);
      if (pS > aS) return false;
      S = max(S, v[i].point * (1.0 - c * v[i].pre / T));
    }
    return true;
  };
  double L = 0.0, R = 1.0;
  while (R - L > 1e-11) {
    double M = (L + R) / 2.0;
    if (check(M))
      L = M;
    else
      R = M;
  }
  cout << fixed << setprecision(11) << L;
  return 0;
}
