#include <bits/stdc++.h>
using namespace std;
void Solve() {
  int n;
  cin >> n;
  int A[102], B[102];
  for (int i = 1; i <= n; ++i) cin >> A[i];
  for (int i = 1; i <= n; ++i) cin >> B[i];
  int flaw = 0;
  for (int i = 1; i <= n; ++i) {
    if (A[i] != B[i])
      flaw++;
    else
      A[i] = B[i] = 3;
  }
  if (flaw == 0) {
    cout << "-1" << endl;
    return;
  }
  int a = 0, b = 0;
  for (int i = 1; i <= n; ++i) {
    if (A[i] == 0) a++;
    if (B[i] == 0) b++;
  }
  int pass = a + 1;
  if (b == 0) {
    cout << "-1" << endl;
    return;
  }
  if (a == 0) {
    cout << "1" << endl;
    return;
  }
  int ans = pass / b;
  if (pass % b) ans++;
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  Solve();
  return 0;
}
