#include <bits/stdc++.h>
using namespace std;
const int MAXN = 160000;
const long double eps = 1e-8;
int t[MAXN];
int p[MAXN];
long long T;
long double mn[MAXN];
long double mx[MAXN];
int n;
vector<int> cmpr;
vector<int> vv;
long long sb[MAXN];
long long st[MAXN];
int gr[MAXN];
int p2[MAXN];
bool cmp1(int a, int b) {
  return (long long)t[a] * (long long)p[b] < (long long)t[b] * (long long)p[a];
}
int check(long double c) {
  for (int i = 0; i < (int)cmpr.size(); ++i) mn[i] = 1e8 + 100, mx[i] = 0;
  for (int i = 0; i < n; ++i) {
    long double mx1 = p[i] * (1.0 - c * ((long double)sb[gr[i]] + t[i]) / T);
    long double mn1 = p[i] * (1.0 - c * (long double)sb[gr[i] + 1] / T);
    mn[p2[i]] = min(mn[p2[i]], mn1);
    mx[p2[i]] = max(mx[p2[i]], mx1);
  }
  long double mx1 = 0;
  for (int i = 0; i < (int)cmpr.size(); ++i) {
    if (mx1 > mn[i]) return 0;
    mx1 = max(mx1, mx[i]);
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", p + i), cmpr.push_back(p[i]);
  sort(cmpr.begin(), cmpr.end());
  cmpr.resize(unique(cmpr.begin(), cmpr.end()) - cmpr.begin());
  for (int i = 0; i < n; ++i)
    p2[i] = lower_bound(cmpr.begin(), cmpr.end(), p[i]) - cmpr.begin();
  for (int i = 0; i < n; ++i) scanf("%d", t + i);
  for (int i = 0; i < n; ++i) vv.push_back(i);
  sort(vv.begin(), vv.end(), cmp1);
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    st[cnt] += t[vv[i]];
    gr[vv[i]] = cnt;
    if (i == n - 1 || cmp1(vv[i], vv[i + 1])) {
      ++cnt;
      sb[cnt] += sb[cnt - 1] + st[cnt - 1];
    }
  }
  T = sb[cnt];
  long double l = 0;
  long double r = 1;
  while (r - l > eps) {
    long double m = (l + r) / 2;
    if (check(m))
      l = m;
    else
      r = m;
  }
  cout.setf(ios::fixed);
  cout.precision(20);
  cout << l << "\n";
  return 0;
}
