#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> r(n, 0), b(n, 0);
  for (int i = 0; i < n; i++) cin >> r[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int rcount = 0, bcount = 0, val;
  for (int i = 0; i < n; i++) {
    if (r[i] == 0 and b[i] == 1)
      bcount++;
    else if (r[i] == 1 and b[i] == 0)
      rcount++;
  }
  if (rcount == 0)
    val = -1;
  else
    val = bcount / rcount + 1;
  cout << val << "\n";
}
