#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, k = 0, j = 0;
  cin >> n;
  int a[n], b[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 1) k++;
    if (a[i] == 1 && b[i] == 0) j++;
  }
  if (k == 0 && j == 0)
    cout << -1 << endl;
  else if (j == 0)
    cout << -1 << endl;
  else
    cout << (k / j) + 1 << endl;
  return 0;
}
