#include <bits/stdc++.h>
using namespace std;
int r, b, n, a, c;
vector<int> v, w;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> r;
    v.push_back(r);
  }
  for (int i = 0; i < n; i++) {
    cin >> b;
    w.push_back(b);
  }
  for (int i = 0; i < n; i++) {
    if (v[i] == 1 && w[i] == 0) {
      a++;
    }
    if (w[i] == 1 && v[i] == 0) {
      c++;
    }
  }
  if (a == 0) {
    cout << -1;
    return 0;
  }
  if ((c + 1) % a == 0) {
    cout << (c + 1) / a;
  } else {
    cout << (c + 1) / a + 1;
  }
  return 0;
}
