#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  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 pa = 0, pb = 0;
  for (int i = 0; i < n; i++) {
    if (r[i] == 1 && b[i] == 0)
      pa++;
    else if (r[i] == 0 && b[i] == 1)
      pb++;
    else
      continue;
  }
  if (pa == 0)
    cout << -1;
  else {
    int res = ceil((double)((pb + 1.0) / pa));
    cout << res;
  }
  return 0;
}
