#include <bits/stdc++.h>
using namespace std;
const int N = 150005;
int p[N], t[N], n, f[N];
double val[N], Min[N], Max[N];
int cmp(int x, int y) {
  return (long long)p[y] * t[x] < (long long)p[x] * t[y] ||
         ((long long)p[y] * t[x] <= (long long)p[x] * t[y] && p[x] < p[y]);
}
int cmp2(int x, int y) { return p[x] < p[y]; }
int pd(double x) {
  double now = 0;
  for (int i = 1, j = 1; i <= n; i = j) {
    while (j <= n && p[f[i]] == p[f[j]]) {
      if (now > p[f[j]] * (1 - Max[f[j]] * x)) return 0;
      j++;
    }
    for (int k = i; k < j; k++) now = max(now, p[f[k]] * (1 - Min[f[k]] * x));
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &t[i]);
  for (int i = 1; i <= n; i++) f[i] = i;
  sort(f + 1, f + n + 1, cmp);
  double T = 0, k = 0;
  for (int i = 1; i <= n; i++) T += t[i];
  for (int i = 1; i <= n; i++) {
    k += t[f[i]];
    val[f[i]] = k / T;
  }
  for (int i = 1, j = 1; i <= n; i = j) {
    while (j <= n &&
           (long long)p[f[i]] * t[f[j]] == (long long)p[f[j]] * t[f[i]])
      j++;
    double t1 = val[f[i - 1]], t2 = val[f[j - 1]];
    for (int k = i; k < j; k++)
      Min[f[k]] = t1 + (double)t[f[k]] / T, Max[f[k]] = t2;
  }
  double l = 0, r = 1;
  sort(f + 1, f + n + 1, cmp2);
  while (l + 1e-8 < r) {
    double mid = (l + r) / 2;
    if (pd(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%.10lf\n", l);
}
