#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n], b[n];
  int sa = 0, sb = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sa += a[i];
  }
  int diff = 0, comm = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (a[i] == 1 && b[i] == 0) {
      diff++;
    } else if (a[i] == 0 && b[i] == 1) {
      comm++;
    }
    sb += b[i];
  }
  if (sb >= sa && diff == 0) {
    cout << -1 << endl;
  } else {
    if (sa > sb) {
      cout << 1 << endl;
    } else {
      if (sb == sa) {
        cout << 2 << endl;
        return;
      }
      cout << comm / diff + 1 << endl;
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
