#include <bits/stdc++.h>
using namespace std;
struct X {
  long long p, t, tl, tr;
};
bool chk(double c, vector<X> &A, vector<long long> t, int N) {
  double maxS = 0;
  for (int i = 1, j; i <= N; i = j) {
    double maxs = 0;
    for (j = i; j <= N && A[i].p == A[j].p; j++) {
      if (A[j].p * (1 - c * A[j].tr / t[N]) < maxS) return false;
      maxs = max(maxs, A[j].p * (1 - c * A[j].tl / t[N]));
    }
    maxS = max(maxS, maxs);
  }
  return true;
}
int main() {
  int N;
  scanf("%d", &N);
  vector<X> A(N + 1);
  vector<long long> t(N + 1, 0);
  for (int i = 1; i <= N; i++) scanf("%lld", &A[i].p);
  for (int i = 1; i <= N; i++) scanf("%lld", &A[i].t);
  sort(A.begin() + 1, A.end(),
       [](X &a, X &b) { return a.p * b.t > b.p * a.t; });
  for (int i = 1; i <= N; i++) t[i] = t[i - 1] + A[i].t;
  for (int i = 1, j; i <= N; i = j) {
    for (j = i; j <= N && A[i].p * A[j].t == A[j].p * A[i].t; j++)
      ;
    for (int k = i; k < j; k++) {
      A[k].tl = t[i - 1] + A[k].t;
      A[k].tr = t[j - 1];
    }
  }
  sort(A.begin() + 1, A.end(), [](X &a, X &b) { return a.p < b.p; });
  double l = 0, r = 1;
  while (abs(r - l) > 0.000000001) {
    double mid = (l + r) / 2;
    if (chk(mid, A, t, N))
      l = mid;
    else
      r = mid;
  }
  printf("%.20f\n", l);
  return 0;
}
