#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e2 + 10;
int a[maxx], b[maxx];
int n;
inline bool check(int m) {
  int max1 = 0, max2 = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] && !b[i])
      max1 += m;
    else if (a[i] && b[i])
      max1 += 1, max2 += 1;
    else if (!a[i] && b[i])
      max2 += 1;
    else
      ;
  }
  return max1 > max2;
}
int main() {
  while (cin >> n && n) {
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    int l = 1, r = 1e7, mid;
    int ans = -1;
    while (l <= r) {
      mid = l + r >> 1;
      if (check(mid)) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    cout << ans << endl;
  }
  return 0;
}
