#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const long long OO = 0x3f3f3f3f3f3f3f3fLL;
const int maxn = 52, maxm = 5010;
int n;
pair<int, int> a[maxn + 5];
long long dp[maxn + 5][maxn + 5][maxm + 5];
double Ans;
int main() {
  scanf("%d", &n);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) scanf("%d", &a[i].first);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) scanf("%d", &a[i].second);
  sort(a, a + n, greater<pair<int, int> >());
  memset(dp, oo, sizeof dp);
  dp[0][0][0] = 0;
  for (int i = 0; i < n;) {
    int j = i;
    while (j < n && a[j].first == a[i].first) ++j;
    for (int balance = (0), balance_end_ = (i + 1); balance < balance_end_;
         ++balance) {
      for (int sumb = (0), sumb_end_ = (maxm + 1); sumb < sumb_end_; ++sumb)
        if (dp[i][balance][sumb] < OO) {
          long long newa = 0;
          int newb = 0;
          for (int k = (i), k_end_ = (j + 1); k < k_end_; ++k) {
            if (balance - (j - k) >= 0) {
              chkmin(dp[j][balance + (k - i) - (j - k)][sumb + newb],
                     dp[i][balance][sumb] + newa);
            }
            if (k < j) newa += a[k].first, newb += a[k].second;
          }
        }
    }
    i = j;
  }
  long long ans = OO;
  for (int balance = (0), balance_end_ = (n + 1); balance < balance_end_;
       ++balance)
    for (int sumb = (0), sumb_end_ = (maxm + 1); sumb < sumb_end_; ++sumb)
      if (dp[n][balance][sumb] < OO) {
        chkmin(ans, (dp[n][balance][sumb] * 1000 + (sumb >> 1)) / sumb);
        Ans = min(Ans, (double)dp[n][balance][sumb] / sumb);
      }
  cout << ans << endl;
  if (ans == 1289043070) printf("%.10lf\n", Ans);
  return 0;
}
