#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  x *= f;
}
struct node {
  long long a, t;
} x[200005];
bool cmp1(node a, node b) { return 1.0 * a.t / a.a < 1.0 * b.t / b.a; }
bool cmp2(int a, int b) {
  return x[a].a == x[b].a ? x[a].t > x[b].t : x[a].a < x[b].a;
}
const long double eps = 1e-8;
long double c;
int n;
int id[200002];
long long tot;
long long L[200002], R[200002], s[200002];
void Solve(int l, int r) {
  sort(id + l, id + r + 1, cmp2);
  for (int i = 2; i <= n; ++i) {
    long double fz = (x[id[i]].a - x[id[i - 1]].a) * tot;
    if (fabs(fz) < eps) continue;
    long double fm = x[id[i]].a * s[R[id[i]]] -
                     x[id[i - 1]].a * (s[L[id[i - 1]] - 1] + x[id[i - 1]].t);
    if (fm < 0) continue;
    c = min(c, fz / fm);
  }
}
int main() {
  read(n);
  c = 1;
  for (int i = 1; i <= n; ++i) read(x[i].a);
  for (int i = 1; i <= n; ++i) read(x[i].t), tot += x[i].t;
  sort(x + 1, x + n + 1, cmp1);
  for (int i = 1; i <= n; ++i) s[i] = s[i - 1] + x[i].t;
  L[1] = 1;
  for (int i = 2; i <= n; ++i)
    L[i] = (x[i].a * x[i - 1].t == x[i].t * x[i - 1].a ? L[i - 1] : i);
  R[n] = n;
  for (int i = n - 1; i >= 1; --i)
    R[i] = (x[i].a * x[i + 1].t == x[i].t * x[i + 1].a ? R[i + 1] : i);
  for (int i = 1; i <= n; ++i) id[i] = i;
  Solve(1, n);
  cout << fixed << setprecision(10) << c << '\n';
  return 0;
}
