#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int r[n], p[n], c = 0, d = 0, e = 0;
  for (long long int i = 0; i < n; i++) cin >> r[i];
  for (long long int i = 0; i < n; i++) cin >> p[i];
  for (long long int i = 0; i < n; i++) {
    if (r[i] == p[i])
      c++;
    else if (r[i] == 1)
      d++;
    else if (p[i] == 1)
      e++;
  }
  if (c == n)
    cout << -1 << endl;
  else if (d > e)
    cout << 1 << endl;
  else {
    if (d == 0)
      cout << -1 << endl;
    else if (e % d == 0)
      cout << (e / d) + 1 << endl;
    else {
      long long int q = e / d;
      cout << q + 1 << endl;
    }
  }
  return 0;
}
