#include <bits/stdc++.h>
using namespace std;
int a[111], b[111];
int main() {
  int i, j, k, l, m, n, p1 = 0, p2 = 0;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 0; i < n; i++) {
    if (a[i] == b[i]) continue;
    if (a[i] == 1)
      p1++;
    else if (b[i] == 1)
      p2++;
  }
  if (p1 != 0)
    cout << (p2 / p1) + 1 << endl;
  else
    cout << -1 << endl;
  return 0;
}
