#include <bits/stdc++.h>
using namespace std;
namespace Io {
char Buf[1 << 20], *S, *T, c;
int f;
char getc() {
  if (S == T) {
    S = Buf;
    T = Buf + fread(Buf, 1, 1 << 20, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
template <class T>
void rd(T &x) {
  f = 1;
  for (c = getc(); c > '9' || c < '0'; c = getc())
    if (c == '-') f = -1;
  for (x = 0; c >= '0' && c <= '9'; c = getc())
    x = (x << 1) + (x << 3) + (c ^ 48);
  x *= f;
}
}  // namespace Io
using Io::rd;
const int MAXN = 2e5 + 5;
const long double Exp = 1e-10;
struct Node {
  int A, T;
  long double Min, Max;
  bool operator<(const Node &x) const { return 1ll * A * x.T > 1ll * x.A * T; }
} a[MAXN];
int n;
long double T;
bool cmp(const Node &x, const Node &y) { return x.A < y.A; }
void Get() {
  sort(a + 1, a + n + 1);
  long double pret = 0;
  for (int i = 1, j; i <= n; i = j + 1) {
    j = i;
    while (j + 1 <= n && 1ll * a[j + 1].A * a[i].T == 1ll * a[i].A * a[j + 1].T)
      j++;
    long double sum = 0;
    for (int k = i; k <= j; k++) {
      a[k].Min = (long double)a[k].A * (pret + a[k].T) / T;
      sum += a[k].T;
    }
    pret += sum;
    for (int k = i; k <= j; k++) a[k].Max = (long double)a[k].A * pret / T;
  }
}
int main() {
  rd(n);
  for (int i = 1; i <= n; i++) rd(a[i].A);
  for (int i = 1; i <= n; i++) rd(a[i].T), T += a[i].T;
  Get();
  sort(a + 1, a + n + 1, cmp);
  long double ans = 1.0;
  for (int i = 1; i < n; i++)
    if (a[i].A != a[i + 1].A) {
      long double up = 1e9, down = 0.0;
      for (int j = i; a[j].A == a[i].A; j--) up = min(a[j].Min, up);
      for (int j = i + 1; a[j].A == a[i + 1].A; j++) down = max(down, a[j].Max);
      if (up < down) {
        ans = min(ans, (long double)(a[i].A - a[i + 1].A) / (up - down));
      }
    }
  printf("%.9lf\n", (double)ans);
  return 0;
}
