#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    int n, i, ones = 0, minusones = 0;
    cin >> n;
    vector<int> r(n), b(n);
    for (i = 0; i < n; i++) cin >> r[i];
    if (accumulate(r.begin(), r.end(), 0) == 0) {
      cout << -1 << endl;
      continue;
    }
    for (i = 0; i < n; i++) {
      cin >> b[i];
      b[i] = b[i] - r[i];
      if (b[i] == 1) ones++;
      if (b[i] == -1) minusones++;
    }
    if (minusones == 0) {
      cout << -1 << endl;
      continue;
    }
    cout << ones / minusones + 1 << endl;
  }
}
