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