#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a[110];
  int b[110];
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  int diffs = 0;
  int asolvs = 0;
  int bsolvs = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] && !b[i]) diffs++;
    if (a[i]) asolvs++;
    if (b[i]) bsolvs++;
  }
  if (diffs) {
    if (asolvs > bsolvs)
      printf("1\n");
    else {
      int aux = bsolvs - (asolvs - diffs) + 1;
      int resp = int(ceil((float)aux / diffs));
      printf("%d\n", resp);
    }
  } else
    printf("-1\n");
}
