#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a[100], b[100];
  bool all_same = true;
  double mini = 0, d = 0, ans;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) mini++;
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    if (b[i] == 1 && a[i] == 1) mini--;
    if (b[i] == 1 && a[i] == 0) d++;
    if (b[i] != a[i]) all_same = false;
  }
  if (all_same == true || mini == 0) {
    cout << -1;
    return 0;
  }
  ans = (double)(d / mini);
  ans = floor(ans) + 1;
  cout << ans;
}
