#include <bits/stdc++.h>
using namespace std;
int equal(int a[], int n) {
  int f = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] != a[i + 1]) {
      f = 1;
      break;
    }
  }
  return f;
}
int minid(int a[], int n) {
  int id = 0;
  int min = a[0];
  for (int i = 1; i < n; i++) {
    if (a[i] < a[i - 1]) {
      min = a[i];
      id = i;
    }
  }
  return id;
}
int main() {
  int n;
  cin >> n;
  int a[n];
  int b[n];
  int x = 0, y = 0;
  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)
      x++;
    else if (b[i] == 1 && a[i] == 0)
      y++;
  }
  if ((x == n && y == n) || x == 0)
    cout << -1 << endl;
  else {
    int a = y / x;
    a += 1;
    cout << a << endl;
  }
}
