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