#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[101];
  int b[101];
  int i, n, sumb = 0, suma = 0, count = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    suma += a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
    sumb += b[i];
  }
  for (i = 0; i < n; i++) {
    if (a[i] == 1 && b[i] == 0) {
      count++;
    }
  }
  if (suma > sumb) {
    cout << "1" << endl;
  } else {
    if (count == 0)
      cout << "-1" << endl;
    else {
      suma = suma - count;
      sumb = sumb - suma;
      cout << sumb / count + 1 << endl;
    }
  }
  return 0;
}
