#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, i, j, k, x, y, z;
  long long arr[102], r[102], b[102];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> r[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  x = 0;
  y = 0;
  z = 0;
  for (i = 0; i < n; i++) {
    if (r[i] == 1 && b[i] == 0) {
      x++;
    }
    if (r[i] == 0 && b[i] == 1) {
      y++;
    }
    if (r[i] == 1 && b[i] == 1) {
      z++;
    }
  }
  if (x == 0) {
    cout << -1;
  } else {
    cout << (y / x) + 1;
  }
  return 0;
}
