#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, c1 = 0, c2 = 0;
  cin >> n;
  int ar[n], br[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> br[i];
  }
  for (int i = 0; i < n; i++) {
    if (ar[i] != br[i]) {
      if (ar[i] == 1)
        c1++;
      else
        c2++;
    }
  }
  if (c1 == 0 && c2 == 0)
    cout << -1 << endl;
  else if (c1 == 0)
    cout << -1 << endl;
  else {
    int d = c2 / c1;
    cout << d + 1 << endl;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  { solve(); }
  return 0;
}
