#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e2 + 9;
long long a[inf], b[inf], n;
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long cnt1 = 0, cnt2 = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> b[i];
    if (b[i] && a[i]) continue;
    if (b[i]) cnt2++;
    if (a[i]) cnt1++;
  }
  if (cnt1 == 0) cout << -1 << endl, exit(0);
  if (cnt1 > cnt2)
    cout << 1 << endl;
  else {
    long long dec = cnt2 - cnt1;
    cout << 1 + (dec) / cnt1 + 1 << endl;
  }
}
