#include <bits/stdc++.h>
using namespace std;
const int N = 50 + 10;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
int n, a[N], b[N];
struct dat {
  int x, y;
  double p;
  dat() {}
  dat(int x, int y, double p) : x(x), y(y), p(p) {}
  bool operator<(const dat &rhs) const {
    return x > rhs.x || x == rhs.x && p > rhs.p;
  }
} g[N];
double dp[N][N];
bool check(double k) {
  for (int i = 1; i <= n; i++) g[i] = dat(a[i], b[i], a[i] - b[i] * k);
  sort(g + 1, g + n + 1);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) dp[i][j] = INF;
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++) {
      if (i - j > j) continue;
      int t = i - 1;
      while (t > 0 && g[t].x == g[i].x) t--;
      dp[i][j] = min(dp[t][j], dp[i - 1][j - 1] + g[i].p);
    }
  for (int i = (n + 1) / 2; i <= n; i++)
    if (dp[n][i] <= 0) return 1;
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  double L = 0, R = INF;
  while (R - L > eps) {
    double mid = (L + R) / 2;
    if (check(mid))
      R = mid;
    else
      L = mid;
  }
  printf("%.0lf\n", ceil((R - eps) * 1000));
  return 0;
}
