#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  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 p1 = 0, p2 = 0, diff = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) {
      p1++;
      if (b[i] == 1) {
        p2++;
      } else {
        diff++;
      }
    } else {
      if (b[i] == 1) p2++;
    }
  }
  if (diff == 0)
    cout << -1;
  else {
    if (p2 - p1 < 0) {
      cout << 1;
    } else {
      cout << (p2 - p1) / diff + 2;
    }
  }
}
