#include <bits/stdc++.h>
using namespace std;
inline int rd(int f = 1, int x = 0, char ch = ' ') {
  while (!isdigit(ch = getchar()))
    if (ch == '-') f = -1;
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f * x;
}
const int N = 1.5e5 + 5;
const double eps = 1e-6;
int n;
double ans, T;
struct V {
  int a, b;
  double c, d;
} v[N];
int main() {
  n = rd(), ans = 1;
  for (int i = 1; i <= n; ++i) v[i].a = rd();
  for (int i = 1; i <= n; ++i) v[i].b = rd();
  sort(v + 1, v + n + 1,
       [&](V p, V q) { return (long long)p.a * q.b > (long long)q.a * p.b; });
  for (int i = 1, j; i <= n; i = j + 1) {
    for (j = i; j + 1 <= n && (long long)v[j + 1].a * v[i].b ==
                                  (long long)v[i].a * v[j + 1].b;
         ++j)
      ;
    for (int k = i; k <= j; ++k) v[k].c = v[k].a * (T + v[k].b);
    for (int k = i; k <= j; ++k) T += v[k].b;
    for (int k = i; k <= j; ++k) v[k].d = v[k].a * T;
  }
  sort(v + 1, v + n + 1, [&](V p, V q) { return p.a < q.a; });
  for (int i = 2, j; i <= n; ++i)
    if (v[i - 1].a != v[i].a) {
      double s = 0, t = 1e100;
      for (j = i - 1; j && v[j].a == v[i - 1].a; t = min(v[j--].c, t))
        ;
      for (j = i; j <= n && v[j].a == v[i].a; s = max(v[j++].d, s))
        ;
      if (t + eps < s) ans = min(ans, T * (v[i].a - v[i - 1].a) / (s - t));
    }
  printf("%lf\n", ans);
  return 0;
}
