#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n, m, k, q, l, r, x, y;
const long long N = 2e5 + 7;
vector<long long> ar(N);
string s, t;
long long ans = 0;
void solve() {
  cin >> n;
  vector<long long> a(n), b(n);
  for (auto &i : a) cin >> i;
  for (auto &i : b) cin >> i;
  x = 0, y = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 1) y++;
    if (a[i] == 1 && b[i] == 0) x++;
  }
  if (x > y)
    ans = 1;
  else if (x == 0)
    ans = -1;
  else if (y >= x) {
    l = y / x;
    ans = l + 1;
  }
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(12) << fixed;
  long long tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
