#include <bits/stdc++.h>
using namespace std;
struct tll {
  long long ek, du, tin;
};
inline void input(long long arr[], long long size) {
  for (long long i = 0; i < size; i++) cin >> arr[i];
}
inline long long gcd(long long a, long long b) {
  return (b == 0) ? a : gcd(b, a % b);
}
bool fequal(double a, double b) { return fabs(a - b) < DBL_EPSILON; }
bool comp(long long i1, long long i2) { return (i1 < i2); }
void solve() {
  long long n;
  cin >> n;
  long long rwins = 0, bwins = 0, ronlywins = 0, bonlywins = 0;
  long long r[n], b[n];
  input(r, n);
  input(b, n);
  for (int i = 0; i < n; i++) {
    if (r[i] == 1) rwins++;
    if (b[i] == 1) bwins++;
    if (b[i] == 0 and r[i] == 1) ronlywins++;
    if (b[i] == 1 and r[i] == 0) bonlywins++;
  }
  if (ronlywins == 0) {
    cout << "-1\n";
    return;
  } else
    cout << (bonlywins) / ronlywins + 1 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
