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