#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int r[n], b[n];
  for (auto i = 0; i < n; i++) cin >> r[i];
  for (auto i = 0; i < n; i++) cin >> b[i];
  long long int c1 = 0, c2 = 0;
  for (auto i = 0; i < n; i++) {
    if (r[i] == 1 && b[i] == 0) c1++;
    if (r[i] == 0 && b[i] == 1) c2++;
  }
  long long int ans = -1;
  if (c1 == 0)
    ans = -1;
  else if (c2 == 0)
    ans = 1;
  else if (c1 > c2)
    ans = 1;
  else if (c1 < c2) {
    for (long long int j = 200; j > 0; j--)
      if (c1 * j > c2) ans = j;
  } else
    ans = 2;
  cout << ans << "\n";
  return 0;
}
