#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int r[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  int cnt = 0, need = 0;
  for (int i = 0; i < n; i++) {
    if (r[i] && !b[i]) {
      cnt++;
    } else if (b[i] && !r[i]) {
      need++;
    }
  }
  if (cnt == 0) {
    cout << "-1" << endl;
  } else {
    int ans = ceil((float)(need + 1) / cnt);
    cout << ans << endl;
  }
  return 0;
}
