#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 c = 0, d = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1 && b[i] != 1)
      c++;
    else if (b[i] == 1 && a[i] != 1)
      d++;
  }
  if (c == 0)
    cout << "-1" << endl;
  else if (1) {
    cout << (d / c) + 1 << endl;
  }
  return 0;
}
