#include <bits/stdc++.h>
using namespace std;
int main() {
  long long test;
  test = 1;
  while (test--) {
    long long n;
    cin >> n;
    long long a[n], b[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    for (long long i = 0; i < n; i++) cin >> b[i];
    long long aalone = 0, balone = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] == 1 && b[i] == 0)
        aalone++;
      else if (a[i] == 0 && b[i] == 1)
        balone++;
    }
    if (aalone == 0)
      cout << "-1";
    else {
      if ((balone + 1) % aalone == 0)
        cout << (balone + 1) / aalone;
      else {
        cout << (balone + 1) / aalone + 1;
      }
    }
  }
}
