#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[200], b[200];
  int countA = 0;
  int countB = 0;
  int countC = 0;
  int n = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1 && b[i] == 0) countA++;
    if (a[i] == b[i]) countB++;
    if (a[i] < b[i]) countC++;
  }
  if (countA == 0) {
    countA = -1;
  } else {
    countA = (countC / countA) + 1;
  }
  printf("%d", countA);
  return 0;
}
