#include <bits/stdc++.h>
using namespace std;
const int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
const int N = 1e3 + 10;
const int mod = 1e9 + 7;
const double pi = acos(-1);
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
int n, m, K;
int a[N], b[N];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> b[i];
  }
  int cnta = 0, cntb = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] != b[i]) {
      if (a[i])
        cnta++;
      else
        cntb++;
    }
  }
  if (cnta == 0) {
    return cout << -1 << endl, 0;
  }
  int res = 0;
  res = cntb / cnta;
  if (res * cnta <= cntb) res++;
  cout << res << endl;
  return 0;
}
