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