#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<bool> first(n), second(n);
  for (long long i = 0; i < n; ++i) {
    bool a;
    cin >> a;
    first[i] = a;
  }
  for (long long i = 0; i < n; ++i) {
    bool a;
    cin >> a;
    second[i] = a;
  }
  long long f = 0, s = 0;
  for (long long i = 0; i < n; ++i) {
    if (second[i] && !(first[i])) ++s;
    if (first[i] && !(second[i])) ++f;
  }
  if (f == 0 && s >= f)
    cout << -1;
  else
    cout << (s / f) + 1 << endl;
  return 0;
}
