#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long double pi = acos(-1.0);
const string debug_line = "yolo";
const long double PI = acos((long double)-1.0);
vector<pair<long long, long long> > scores;
long long p[150010];
long long t[150010];
int n;
bool poss(double mid) {
  sort(scores.begin(), scores.end(),
       [](const pair<int, int> &a, const pair<int, int> &b) {
         return (long long)a.first * (long long)b.second >
                (long long)a.second * (long long)b.first;
       });
  long long sum1 = 0;
  long long totalTime = 0;
  for (int(i) = (0); (i) < (scores.size()); ++(i)) {
    totalTime += scores[i].second;
  }
  vector<pair<int, pair<double, double> > > points;
  for (int i = 0; i < scores.size();) {
    int j = i;
    while (j < scores.size() && scores[i].first * scores[j].second ==
                                    scores[i].second * scores[j].first) {
      j++;
    }
    double timeNow = 0;
    for (int(k) = (i); (k) < (j); ++(k)) {
      timeNow += scores[k].second;
    }
    for (int(k) = (i); (k) < (j); ++(k)) {
      double max1 = (double)scores[k].first *
                    (double)(1 - mid * (double)(sum1 + scores[k].second) /
                                     (double)totalTime);
      double max2 =
          (double)scores[k].first *
          (double)(1 - mid * (double)(sum1 + timeNow) / (double)totalTime);
      points.push_back(make_pair(scores[k].first, make_pair(max2, max1)));
    }
    i = j;
    sum1 += timeNow;
  }
  sort(points.begin(), points.end());
  double max1 = -1;
  bool poss = true;
  for (int i = 0; i < n;) {
    int j = i;
    while (j < n && points[i].first == points[j].first) {
      j++;
    }
    for (int(k) = (i); (k) < (j); ++(k)) {
      if (max1 > points[k].second.first) {
        poss = false;
      }
    }
    for (int(k) = (i); (k) < (j); ++(k)) {
      max1 = max(max1, points[k].second.second);
    }
    i = j;
  }
  return poss;
}
int main() {
  scanf("%d", &n);
  for (int(i) = (0); (i) < (n); ++(i)) {
    int temp1;
    scanf("%d", &temp1);
    p[i] = temp1;
  }
  for (int(i) = (0); (i) < (n); ++(i)) {
    int temp1;
    scanf("%d", &temp1);
    t[i] = temp1;
  }
  for (int(i) = (0); (i) < (n); ++(i)) {
    scores.push_back(make_pair(p[i], t[i]));
  }
  double l1 = 0;
  double h1 = 1;
  for (int(times) = (0); (times) < (101); ++(times)) {
    double mid1 = (l1 + h1) / 2;
    if (poss(mid1)) {
      l1 = mid1;
    } else {
      h1 = mid1;
    }
  }
  printf("%.6lf\n", l1);
  return 0;
}
