#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, c1, c2, x;
int a[N], b[N];
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);
  for (int i = 1; i <= n; i++)
    if (a[i] == 1 && b[i] == 0)
      c1++;
    else if (a[i] == 0 && b[i] == 1)
      c2++;
  if (c1 == 0)
    printf("-1\n");
  else if (c1 > c2)
    printf("1\n");
  else
    printf("%d\n", (c2 / c1) + 1);
}
