#include <bits/stdc++.h>
long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
struct yyb {
  int p, t;
} s[150010];
long long mxT[150010], mnT[150010];
struct zsy {
  double t;
  int i, o;
} A[300010];
bool operator<(const yyb& a, const yyb& b) {
  return 1ll * a.p * b.t > 1ll * a.t * b.p;
}
bool operator<(const zsy& a, const zsy& b) { return a.t < b.t; }
int u[150010], P[150010], U;
int t[150010];
void update(int x) {
  while (x <= U) ++t[x], x += x & -x;
}
int query(int x) {
  int r = 0;
  while (x) r += t[x], x -= x & -x;
  return r;
}
int main() {
  int n = gi();
  for (int i = 1; i <= n; ++i) s[i].p = gi(), u[++U] = s[i].p;
  for (int i = 1; i <= n; ++i) s[i].t = gi();
  std::sort(u + 1, u + U + 1);
  U = std::unique(u + 1, u + U + 1) - u - 1;
  std::sort(s + 1, s + n + 1);
  for (int i = 1; i <= n; ++i)
    P[i] = std::lower_bound(u + 1, u + U + 1, s[i].p) - u;
  long long T = 0, sum = 0;
  for (int l = 1, r; l <= n; l = r + 1) {
    r = l;
    while (r < n && !(s[r] < s[r + 1])) ++r;
    sum = 0;
    for (int i = l; i <= r; ++i) sum += s[i].t;
    for (int i = l; i <= r; ++i) mxT[i] = T + sum, mnT[i] = T + s[i].t;
    T += sum;
  }
  double l = 0, r = 1, mid;
  int orzyyb = 30;
  while (orzyyb-- > 0) {
    mid = (l + r) * 0.5;
    int m = 0;
    for (int i = 1; i <= n; ++i)
      A[++m] = {s[i].p * (1 - mid * mnT[i] / T), i, 1},
      A[++m] = {s[i].p * (1 - mid * mxT[i] / T), i, 0};
    memset(t, 0, sizeof t);
    std::sort(A + 1, A + m + 1);
    bool f = 0;
    for (int i = 1, c = 0; i <= m; ++i)
      if (A[i].o) {
        if (query(P[A[i].i]) < c) {
          f = 1;
          break;
        }
      } else
        update(P[A[i].i]), ++c;
    f ? r = mid : l = mid;
  }
  printf("%.10lf\n", (l + r) * 0.5);
  return 0;
}
