#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int NAX = 50 + 10, MAX_PROC = 100 + 10;
int n;
pair<int, int> arr[NAX];
vector<pair<int, int> > q;
double power = 0, ans = 0, def = 0;
int proc = 0;
bool cmp(pair<int, int> a, pair<int, int> b) {
  return (((double)(a.first)) / (a.second) < ((double)(b.first)) / (b.second));
}
bool thresh_work(int thresh) {
  if (thresh >= def) {
    ans = def;
    return true;
  }
  double tmp_pow = power;
  int tmp_proc = proc;
  bool works = 0;
  for (pair<int, int> x : q) {
    tmp_pow += x.first;
    tmp_proc += x.second;
    if (works) {
      ans = min(ans, (1.0 * tmp_pow) / tmp_proc);
    } else if ((1.0 * tmp_pow) / tmp_proc <= thresh) {
      ans = min(ans, (1.0 * tmp_pow) / tmp_proc);
      works = 1;
    }
  }
  return works;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i].first;
  }
  for (int i = 0; i < n; ++i) {
    cin >> arr[i].second;
  }
  sort(arr, arr + n, greater<pair<int, int> >());
  int idx = 0, low, up;
  for (idx; idx < n; idx++) {
    if (idx >= n / 2 and idx != 0) {
      if (arr[idx].first != arr[idx - 1].first) break;
      low =
          lower_bound(arr, arr + n, arr[idx], greater<pair<int, int> >()) - arr;
      up =
          upper_bound(arr, arr + n, arr[idx], greater<pair<int, int> >()) - arr;
      while (low < up - idx) {
        power += arr[idx].first;
        proc += arr[idx].second;
        idx++;
      }
      break;
    } else {
      power += arr[idx].first;
      proc += arr[idx].second;
    }
  }
  def = power / proc;
  for (idx; idx < n; idx++) q.push_back(arr[idx]);
  sort(q.begin(), q.end(), cmp);
  int l = 0, r = 1e9 + 7, mid;
  while (l < r) {
    mid = (l + r) >> 1;
    bool works = thresh_work(mid);
    if (works)
      r = mid - 1;
    else
      l = mid + 1;
  }
  ans *= 1000;
  int ret = ((int)(ans * 10) % 10 != 0) ? ans + 1 : ans;
  cout << ret << "\n";
  return 0;
}
