#include <bits/stdc++.h>
using namespace std;
inline int read() {
  static int x, f;
  static char ch;
  x = 0, f = 1, ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
const int N = 200050;
int n;
struct Problems {
  int a, t;
  bool operator<(const Problems w) const {
    return 1ll * a * w.t > 1ll * w.a * t;
  }
} a[N];
long long sumt;
int id[N];
long long tl[N], tr[N];
inline bool cmpid(int x, int y) {
  if (a[x].a ^ a[y].a) return a[x].a < a[y].a;
  return a[x].t > a[y].t;
}
inline bool cmpid2(int x, int y) {
  if (a[x].a ^ a[y].a) return a[x].a < a[y].a;
  return a[x].t < a[y].t;
}
int main() {
  int i, j, x, y;
  long long nowt, ntl, nl;
  double ans, v;
  n = read();
  for (i = 1; i <= n; ++i) a[i].a = read();
  for (i = 1; i <= n; ++i) a[i].t = read(), sumt += a[i].t;
  sort(a + 1, a + n + 1);
  ntl = nl = -1;
  for (nowt = 0, i = 1; i <= n; ++i) {
    nowt += a[i].t;
    if (ntl == -1) ntl = nowt - a[i].t;
    if (nl == -1) nl = i;
    if (i > 1 && 1ll * a[i].t * a[i - 1].a != 1ll * a[i].a * a[i - 1].t) {
      for (j = nl; j < i; ++j) tl[j] = ntl + a[j].t, tr[j] = nowt - a[i].t;
      ntl = nowt - a[i].t, nl = i;
      continue;
    }
  }
  if (nl != -1)
    for (j = nl; j <= n; ++j) tl[j] = ntl + a[j].t, tr[j] = nowt;
  for (i = 1; i <= n; ++i) id[i] = i;
  sort(id + 1, id + n + 1, cmpid);
  ans = 1;
  for (i = 1; i < n; ++i)
    if (a[id[i]].a != a[id[i + 1]].a) {
      x = id[i], y = id[i + 1];
      v = sumt * (double)(a[y].a - a[x].a) /
          ((long long)a[y].a * tr[y] - (long long)a[x].a * tl[x]);
      if (v > 0) ans = min(ans, v);
    }
  cout << fixed << setprecision(20) << ans << '\n';
  return 0;
}
