#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
int a[maxn], b[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int c1 = 0, c2 = 0, cb = 0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1 && b[i] == 0)
      c1++;
    else if (a[i] == 0 && b[i] == 1)
      c2++;
    else
      cb++;
  }
  if (c1 == 0)
    cout << -1 << endl;
  else if (c2 % c1 == 0)
    cout << ceil(c2 * 1.0 / c1) + 1 << endl;
  else
    cout << ceil(c2 * 1.0 / c1) << endl;
  return 0;
}
