#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  int aSum = 0, bSum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] && !b[i]) {
      aSum++;
    } else if (b[i] && !a[i]) {
      bSum++;
    }
  }
  if (!aSum) {
    cout << "-1\n";
    return 0;
  } else {
    int score = 0;
    while (aSum * score <= bSum) {
      score++;
    }
    cout << score << "\n";
    return 0;
  }
}
