#include <bits/stdc++.h>
int main() {
  int n, ct1 = 0, ct2 = 0;
  scanf("%d", &n);
  int a1[n], a2[n];
  for (int i = 0; i < n; i++) scanf("%d", &a1[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a2[i]);
    if (a1[i] == 0 && a2[i] == 1) ct2++;
    if (a1[i] == 1 && a2[i] == 0) ct1++;
  }
  if (ct1 + ct2 == 0 || ct1 == 0)
    printf("-1\n");
  else if (ct1 > ct2)
    printf("1\n");
  else if (ct1 == ct2)
    printf("2\n");
  else {
    if ((ct2 + 1) % ct1 == 0)
      printf("%d\n", (ct2 + 1) / ct1);
    else {
      printf("%d\n", (ct2 + 1) / ct1 + 1);
    }
  }
  return 0;
}
