#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int i, j, t, n, a[150], b[150], sum1 = 0, sum2 = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (i = 1; i <= n; i++) {
    if (a[i] && !b[i]) sum1++;
    if (!a[i] && b[i]) sum2++;
  }
  if (sum1 == 0) {
    cout << "-1" << '\n';
  } else if (sum1 > sum2) {
    cout << 1 << '\n';
  } else {
    int k = sum2 / sum1;
    k++;
    cout << k << '\n';
  }
}
