#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n, r1 = 0, r2 = 0;
  cin >> n;
  vector<int> r(n);
  for (int &i : r) cin >> i;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a != r[i]) {
      if (a)
        r1++;
      else
        r2++;
    }
  }
  if (!r2)
    cout << "-1\n";
  else if (r2 > r1)
    cout << "1\n";
  else
    cout << (int)ceil((r1 + 1.0) / r2) << "\n";
}
