#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], b[n];
  for (int c = 0; c < n; c++) cin >> a[c];
  for (int c = 0; c < n; c++) cin >> b[c];
  int primul = 0, doi = 0, k = 0;
  for (int c = 0; c < n; c++) {
    if (a[c] == 1 && b[c] == 0) {
      primul++;
      k++;
    }
    if (a[c] == 1 && b[c] == 1) {
      doi++;
      primul++;
    }
    if (a[c] == 0 && b[c] == 1) doi++;
  }
  if (primul > doi)
    cout << '1' << endl;
  else {
    if (k == 0)
      cout << "-1" << endl;
    else {
      int r = doi - primul + 1;
      int ans = r / k;
      if (r % k > 0) ans++;
      cout << ans + 1 << endl;
    }
  }
  return 0;
}
