#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> r(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  int cnt_r_can_b_cntnot = 0, b_cn_r_can_not = 0;
  for (int i = 0; i < n; i++) {
    if (r[i] == 1 && b[i] == 0) cnt_r_can_b_cntnot++;
    if (r[i] == 0 && b[i] == 1) b_cn_r_can_not++;
  }
  if (cnt_r_can_b_cntnot == 0) {
    cout << -1 << "\n";
    return 0;
  }
  cout << (b_cn_r_can_not + 1 + cnt_r_can_b_cntnot - 1) / cnt_r_can_b_cntnot
       << "\n";
  return 0;
}
