#include <bits/stdc++.h>
using namespace std;
int64_t R = 1;
void solution() {
  int64_t n, kr = 0, kb = 0, b = 0, kbr = 0;
  cin >> n;
  vector<int> robo(n), bio(n);
  for (int i = 0; i < n; i++) {
    cin >> robo[i];
    if (robo[i] == 1) {
      kr++;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> bio[i];
    if (bio[i] == 1) {
      kb++;
    }
    if (bio[i] == 1 && robo[i] == 0) {
      kbr++;
    }
    if (robo[i] == 1 && bio[i] == 0) {
      b++;
    }
  }
  if (robo == bio || kb == n || b == 0) {
    cout << "-1"
         << "\n";
    return;
  }
  if (kr > kb) {
    cout << "1"
         << "\n";
    return;
  } else {
    cout << (kbr + b) / b << "\n";
  }
}
int main() {
  while (R--) {
    solution();
  }
  return 0;
}
