#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  bool a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  int counta = 0, countb = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 1) {
      countb++;
    } else if (a[i] == 1 && b[i] == 0) {
      counta++;
    }
  }
  if (counta == 0) {
    cout << -1 << endl;
  } else {
    cout << (countb / counta + 1) << endl;
  }
  return 0;
}
