#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int fr = 0, to = 0;
  for (int i = 0; i < n; i++) {
    int now;
    cin >> now;
    if (a[i] == 1 && now == 0) fr++;
    if (a[i] == 0 && now == 1) to++;
  }
  if (fr == 0)
    cout << -1;
  else {
    for (int i = 1; i < 1000; i++) {
      if (i * fr > to) {
        cout << i;
        break;
      }
    }
  }
}
