#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> r(n), b(n);
  for (auto& i : r) scanf("%d", &i);
  for (auto& i : b) scanf("%d", &i);
  int x, y;
  x = y = 0;
  for (int i = 0; i < n; i++) {
    if (r[i] && !b[i]) x++;
    if (!r[i] && b[i]) y++;
  }
  int ans;
  if (x == 0) {
    ans = -1;
  } else {
    ans = y / x + 1;
  }
  printf("%d", ans);
}
