#include <bits/stdc++.h>
using namespace std;
int a[1000];
int b[1000];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
  }
  int f1 = 0, f2 = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == 1 && b[i] == 0) {
      f1++;
    }
    if (a[i] == 0 && b[i] == 1) {
      f2++;
    }
  }
  if (f1 == 0 && f2 == 0) {
    cout << -1 << endl;
  } else if (f1 == 0) {
    cout << -1 << endl;
  } else {
    double sum = f2 + 1;
    sum = sum / f1;
    int res = 0;
    if (sum - (int)sum > 0) {
      res = int(sum) + 1;
    } else {
      res = int(sum);
    }
    cout << res << endl;
  }
}
