#include <bits/stdc++.h>
using namespace std;
const int N = 150003;
const long double eps = 1e-10L;
template <typename T>
inline void read(T &x) {
  int ch = getchar();
  x = 0;
  for (; ch < '0' || ch > '9'; ch = getchar())
    ;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  if (a > b) return a = b, 1;
  return 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  if (a < b) return a = b, 1;
  return 0;
}
int n;
long double ans = 1;
long long T, u;
struct Node {
  int p, t;
  long double x, l, r;
  inline bool operator<(const Node &o) const { return x > o.x; }
} a[N];
inline int dcmp(long double x) { return x > eps ? 1 : (x < -eps ? -1 : 0); }
inline bool cmp(const Node &a, const Node &b) { return a.p < b.p; }
int main() {
  read(n);
  for (register int i = 1; i <= n; ++i) read(a[i].p);
  for (register int i = 1; i <= n; ++i)
    read(a[i].t), a[i].x = 1.0L * a[i].p / a[i].t, T += a[i].t;
  sort(a + 1, a + n + 1);
  for (register int i = 1, j = 1; i <= n; i = j) {
    while (j <= n && !dcmp(a[i].x - a[j].x)) ++j;
    for (register int k = i; k < j; ++k)
      a[k].l = 1.0L * a[k].p * (u + a[k].t) / T;
    for (register int k = i; k < j; ++k) u += a[k].t;
    for (register int k = i; k < j; ++k) a[k].r = 1.0L * a[k].p * u / T;
  }
  sort(a + 1, a + n + 1, cmp);
  for (register int i = 1, j; i < n; ++i)
    if (a[i].p < a[i + 1].p) {
      long double l = 1e8, r = 0;
      for (j = i; j && a[i].p == a[j].p; --j) chkmin(l, a[j].l);
      for (j = i + 1; j <= n && a[i + 1].p == a[j].p; ++j) chkmax(r, a[j].r);
      if (dcmp(r - l) > 0) chkmin(ans, (a[i + 1].p - a[i].p) / (r - l));
    }
  printf("%.11Lf\n", ans);
}
