#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int MAXN = 500 * 1000;
int p[MAXN], t[MAXN], ind1[MAXN], ind2[MAXN];
long long s[MAXN];
bool comp1(int ind1, int ind2) {
  if (p[ind1] * (long long)t[ind2] != p[ind2] * (long long)t[ind1]) {
    return (p[ind1] * (long long)t[ind2] > p[ind2] * (long long)t[ind1]);
  }
  return p[ind1] < p[ind2];
}
bool comp2(int ind1, int ind2) {
  return p[ind1] > p[ind2] || (p[ind1] == p[ind2] && s[ind1] < s[ind2]);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
  }
  long long T = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &t[i]);
    T += t[i];
  }
  for (int i = 0; i < n; ++i) {
    ind1[i] = i;
  }
  sort(ind1, ind1 + n, comp1);
  s[ind1[0]] = t[ind1[0]];
  for (int i = 1; i < n; ++i) {
    s[ind1[i]] = s[ind1[i - 1]] + t[ind1[i]];
  }
  for (int i = n - 1; i >= 0; --i) {
    if (i < n - 1 && p[ind1[i]] * (long long)t[ind1[i + 1]] ==
                         p[ind1[i + 1]] * (long long)t[ind1[i]]) {
      s[n + ind1[i]] = s[n + ind1[i + 1]];
    } else {
      s[n + ind1[i]] = s[ind1[i]];
    }
    p[n + ind1[i]] = p[ind1[i]];
  }
  for (int i = 0; i < n; ++i) {
    if (i > 0 && p[ind1[i]] * (long long)t[ind1[i - 1]] ==
                     p[ind1[i - 1]] * (long long)t[ind1[i]]) {
      s[2 * n + ind1[i]] = s[2 * n + ind1[i - 1]] - t[ind1[i - 1]] + t[ind1[i]];
    } else {
      s[2 * n + ind1[i]] = s[ind1[i]];
    }
    p[2 * n + ind1[i]] = p[ind1[i]];
  }
  n *= 3;
  for (int i = 0; i < n; ++i) {
    ind2[i] = i;
  }
  sort(ind2, ind2 + n, comp2);
  long double res = T;
  vector<int> cur;
  for (int i = 0; i < n; ++i) {
    while (((int)(cur).size()) > 1 &&
           (p[cur[((int)(cur).size()) - 1]] *
                (long double)(s[cur[((int)(cur).size()) - 2]] -
                              s[cur[((int)(cur).size()) - 1]]) /
                (p[cur[((int)(cur).size()) - 2]] -
                 p[cur[((int)(cur).size()) - 1]]) /
                p[ind2[i]] /
                (long double)(s[cur[((int)(cur).size()) - 2]] - s[ind2[i]]) *
                (p[cur[((int)(cur).size()) - 2]] - p[ind2[i]]) >
            1 + 1e-9)) {
      cur.pop_back();
    }
    cur.push_back(ind2[i]);
    for (int i = 0; i + 1 < min(((int)(cur).size()), 2); ++i) {
      res = max(res, (p[cur[((int)(cur).size()) - i - 2]] *
                          (long double)s[cur[((int)(cur).size()) - i - 2]] -
                      p[cur[((int)(cur).size()) - i - 1]] *
                          (long double)s[cur[((int)(cur).size()) - i - 1]]) /
                         (p[cur[((int)(cur).size()) - i - 2]] -
                          p[cur[((int)(cur).size()) - i - 1]]));
    }
  }
  cout.precision(20);
  cout << T / res << endl;
  return 0;
}
