#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, a[maxn], b[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) scanf("%d", b + i);
  int x = 0, y = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == b[i]) continue;
    if (a[i] > b[i])
      x++;
    else
      y++;
  }
  if (x == 0) return puts("-1"), 0;
  printf("%d\n", y / x + 1);
  return 0;
}
