#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  int n;
  cin >> n;
  vector<long long> v, w;
  for (long long i = 0; i < n; i++) {
    long long k;
    cin >> k;
    v.push_back(k);
  };
  for (long long i = 0; i < n; i++) {
    long long k;
    cin >> k;
    w.push_back(k);
  };
  int a = 0, b = 0;
  for (long long i = 0; i < n; i++) {
    if (v[i] && !w[i]) a++;
    if (w[i] && !v[i]) b++;
  }
  if (!a)
    cout << -1;
  else
    cout << b / a + 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) solve();
  return 0;
}
