#include <bits/stdc++.h>
using namespace std;
int n, cnt1, cnt2;
bool a[105], b[105];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i]) cnt1 += 1;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    if (b[i]) cnt2 += 1;
  }
  bool p = false;
  int Win = 0, Los = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] && !b[i]) p = true, Win += 1;
    if (!a[i] && b[i]) Los += 1;
  }
  if (!p)
    printf("-1\n");
  else {
    if (cnt1 > cnt2)
      printf("1\n");
    else if (cnt1 == cnt2)
      printf("2\n");
    else {
      Los += 1;
      if (Los % Win == 0)
        printf("%d\n", Los / Win);
      else
        printf("%d\n", Los / Win + 1);
    }
  }
  return 0;
}
