#include <bits/stdc++.h>
using namespace std;
int a[105];
int b[105];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", b + i);
  }
  int ascore = 0, bscore = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1 && b[i] == 0)
      ascore++;
    else if (a[i] == 0 && b[i] == 1)
      bscore++;
  }
  if (ascore == 0) {
    printf("%d", -1);
    return 0;
  } else {
    int ans = (bscore + 1) / ascore;
    if (ans * ascore != bscore + 1) ans++;
    printf("%d", ans);
  }
}
