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