#include <bits/stdc++.h>
using namespace std;
const int maxnnn = 0x3f3f3f3f;
struct node {
  long long x, y;
} ppppos[100050];
bool cmp(long long a, long long b) { return a > b; }
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
map<long long, int> mp;
long long euler(long long n) {
  long long res = n, a = n;
  for (int i = 2; i * i < a; i++)
    if (a % i == 0) {
      res = res / i * (i - 1);
      while (a % i == 0) a /= i;
    }
  if (a > 1) res = res / a * (a - 1);
  return res;
}
long long ppow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n) {
    if (n % 2 == 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    n /= 2;
  }
  return ans % mod;
}
long long fast_mod(long long a, long long b, long long mod) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return ans;
}
int prime(long long x) {
  if (x == 1) return 0;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
long long exgcd(long long a, long long b, long long *x, long long *y) {
  long long xx, yy, g;
  if (a < b) return exgcd(b, a, y, x);
  if (b == 0) {
    *x = 1;
    *y = 0;
    return a;
  } else {
    g = exgcd(b, a % b, &xx, &yy);
    *x = yy;
    *y = (xx - a / b * yy);
    return g;
  }
}
int n;
int a[110], b[110];
int num, ans;
long long ExpGcd(long long a, long long b, long long &x, long long &y) {
  long long temp, p;
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  p = ExpGcd(b, a % b, x, y);
  temp = x;
  x = y;
  y = temp - (a / b) * y;
  return p;
}
int main() {
  scanf("%d", &n);
  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 && a[i] == b[i])
      continue;
    else if (a[i] == 1 && b[i] == 0)
      num++;
    else if (b[i] == 1 && a[i] == 0)
      ans++;
  }
  if (num == 0) {
    cout << -1 << endl;
    return 0;
  }
  cout << ans / num + 1 << endl;
  return 0;
}
