#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  long long cmp1[n], cmp2[n], cnt1 = 0, cnt2 = 0;
  for (long long i = 0; i < n; i++) cin >> cmp1[i];
  for (long long i = 0; i < n; i++) cin >> cmp2[i];
  for (long long i = 0; i < n; i++) {
    if (cmp1[i] == cmp2[i]) continue;
    if (cmp1[i]) cnt1++;
    if (cmp2[i]) cnt2++;
  }
  if (cnt1 == 0) {
    cout << -1;
    return 0;
  }
  if (cnt2 == 0) {
    cout << 1;
    return 0;
  }
  cout << (cnt2 / cnt1) + 1;
  return 0;
}
