#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, x = 0, y = 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] == 1 && b[i] == 0) ++x;
    if (a[i] == 0 && b[i] == 1) ++y;
  }
  if (x == 0)
    cout << "-1";
  else
    cout << ceil(1.0 * (y + 1) / x);
  return 0;
}
