#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long long;
using pii = pair<int, int>;
using vvi = vector<vector<int>>;
using vi = vector<int>;
using vl = vector<ll>;
using pll = pair<ll, ll>;
using vsi = vector<set<int>>;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int r[n];
  int b[n];
  for (int i = 0; i < n; i++) cin >> r[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int df = 0;
  int rq = 0;
  for (int i = 0; i < n; i++) {
    if (r[i] && !b[i])
      df++;
    else if (!r[i] && b[i])
      rq++;
  }
  rq++;
  if (!df)
    cout << -1 << endl;
  else
    cout << rq / df + (rq % df ? 1 : 0);
}
