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