#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}
template <typename T, typename... U>
inline void read(T& x, U&... y) {
  read(x), read(y...);
}
const int N = 5e1 + 10;
const double eps = 1e-6;
int n;
int ID[N];
double K;
double A[N], B[N], F[N][N];
double V(int a) { return A[a] - K * B[a]; }
bool cmp(int a, int b) { return A[a] == A[b] ? V(a) > V(b) : A[a] > A[b]; }
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) scanf("%lf", &A[i]);
  for (int i = 1; i <= n; ++i) scanf("%lf", &B[i]), ID[i] = i;
  double L = 0.01, R = 5e9, res = 233;
  while (R - L >= eps) {
    double mid = (L + R) / 2.0;
    K = mid;
    sort(ID + 1, ID + n + 1, cmp);
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= n; ++j) F[i][j] = 1e18;
    F[0][0] = 0;
    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
      ++cnt;
      double sum = V(ID[i]);
      int p = i;
      while (p != n && A[ID[p + 1]] == A[ID[i]]) sum += V(ID[++p]);
      double g = 0;
      int s = p - i + 1;
      for (int j = 0; j <= s; ++j) {
        if (j) g += V(ID[i + j - 1]);
        for (int k = 0; k <= i - 1; ++k)
          if (j <= k) {
            F[cnt][k - j + s - j] =
                min(F[cnt][k - j + s - j], F[cnt - 1][k] + sum - g);
          }
      }
      i = p;
    }
    double ANS = 1e18;
    for (int i = 0; i <= n; ++i) ANS = min(ANS, F[cnt][i]);
    if (ANS <= eps)
      res = mid, R = mid - eps;
    else
      L = mid + eps;
  }
  printf("%lld\n", (long long)(res * 100000 + 99) / 100);
  return 0;
}
