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