#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long fx[] = {+1, -1, +0, +0};
const long long fy[] = {+0, +0, +1, -1};
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
  }
  vector<long long> points(n, 1);
  long long only_a = 0;
  long long pa = 0, push_back = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 1 && b[i] == 0) {
      only_a++;
    }
    if (a[i] == 1) pa++;
    if (b[i] == 1) push_back++;
  }
  if (pa > push_back) {
    cout << 1 << "\n";
    return;
  } else if (only_a == 0 && pa <= push_back) {
    cout << -1 << "\n";
  } else {
    long long diff = push_back - pa + 1;
    long long x = 1 + diff / only_a;
    if (diff % only_a != 0) x++;
    cout << x << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
