#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int r[n], b[n];
  for (int i = 0; i < n; i++) cin >> r[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int r_but_not_b = 0, b_but_not_r = 0;
  for (int i = 0; i < n; i++)
    if (r[i] && !b[i])
      r_but_not_b++;
    else if (!r[i] && b[i])
      b_but_not_r++;
  b_but_not_r++;
  if (r_but_not_b == 0)
    cout << -1 << '\n';
  else
    cout << b_but_not_r / r_but_not_b + (b_but_not_r % r_but_not_b != 0)
         << '\n';
  return 0;
}
