#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], b[n], c = 0, x = 0, y = 0, z = 0, s = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      x++;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (a[i] != b[i]) {
      c = 1;
    }
    if (b[i] == 1) {
      y++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1 && b[i] == 0) {
      z++;
    }
  }
  if (c == 0 || x == 0 || z == 0) {
    cout << "-1" << endl;
  } else {
    for (int i = 1;;) {
      if (s > y) {
        cout << i - 1 << endl;
        break;
      } else {
        s = z * i + (x - z);
        i++;
      }
    }
  }
  return 0;
}
