#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> goodws(n, 0), badws(n, 0);
  for (int i = 0; i < n; i++) cin >> goodws[i];
  for (int i = 0; i < n; i++) cin >> badws[i];
  int good_points = 0;
  int score1 = 0, score2 = 0;
  for (int i = 0; i < n; i++) {
    score1 += goodws[i];
    score2 += badws[i];
    if (goodws[i] && !badws[i]) ++good_points;
  }
  if (!good_points) {
    cout << "-1\n";
    return 0;
  }
  if (score2 < score1)
    cout << "1\n";
  else
    cout << ((score2 - score1) / good_points + 2) << '\n';
  return 0;
}
