#include <bits/stdc++.h>
using namespace std;
template <typename T>
void Read(T &cn) {
  char c;
  int sig = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') sig = -1;
  cn = c - 48;
  while (isdigit(c = getchar())) cn = cn * 10 + c - 48;
  cn *= sig;
}
template <typename T>
void Write(T cn) {
  if (cn < 0) {
    putchar('-');
    cn = 0 - cn;
  }
  int wei = 0;
  T cm = 0;
  int cx = cn % 10;
  cn /= 10;
  while (cn) wei++, cm = cm * 10 + cn % 10, cn /= 10;
  while (wei--) putchar(cm % 10 + 48), cm /= 10;
  putchar(cx + 48);
}
template <typename T>
void Max(T &cn, T cm) {
  cn = cn < cm ? cm : cn;
}
template <typename T>
void Min(T &cn, T cm) {
  cn = cn < cm ? cn : cm;
}
struct qwe {
  int a, b;
};
qwe a[200000 + 1];
double he[200000 + 1];
int xu[200000 + 1];
int qi[200000 + 1], ho[200000 + 1];
int n;
int Cmp1(int cn, int cm) {
  return a[cn].a == a[cm].a ? a[cn].b > a[cm].b : a[cn].a < a[cm].a;
}
int Cmp2(qwe a, qwe b) {
  long long lin1 = 1ll * b.a * a.b, lin2 = 1ll * a.a * b.b;
  return lin1 < lin2;
}
double qiu() {
  sort(xu + 1, xu + n + 1, Cmp1);
  he[0] = 0;
  for (int i = 1; i <= n; i++) he[i] = he[i - 1] + a[i].b;
  double ans = 1;
  for (int i = 2; i <= n; i++) {
    double lin = he[ho[xu[i]]] * a[xu[i]].a -
                 (he[qi[xu[i - 1]] - 1] + a[xu[i - 1]].b) * a[xu[i - 1]].a;
    if (lin > 0 && a[xu[i]].a != a[xu[i - 1]].a)
      Min(ans, (double)(a[xu[i]].a - a[xu[i - 1]].a) * he[n] / lin);
  }
  return ans;
}
int main() {
  Read(n);
  for (int i = 1; i <= n; i++) Read(a[i].a);
  for (int i = 1; i <= n; i++) Read(a[i].b);
  sort(a + 1, a + n + 1, Cmp2);
  for (int i = 1; i <= n; i++) xu[i] = i;
  qi[1] = 1;
  for (int i = 2; i <= n; i++)
    qi[i] = (a[i].a * a[i - 1].b == a[i].b * a[i - 1].a ? qi[i - 1] : i);
  ho[n] = n;
  for (int i = n - 1; i >= 1; i--)
    ho[i] = (a[i].a * a[i + 1].b == a[i].b * a[i + 1].a ? ho[i + 1] : i);
  printf("%.11lf\n", qiu());
  return 0;
}
