#include <bits/stdc++.h>
using namespace std;
const int manx = 1e5 + 100;
const int INF = 0x3f3f3f3f;
int main() {
  int n, a[200], b[200], cnt = 0, numb1 = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i]) cnt++;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    if (b[i]) {
      if (a[i])
        cnt--;
      else
        numb1++;
    }
  }
  if (!cnt)
    printf("-1\n");
  else
    printf("%d\n", numb1 / cnt + 1);
  return 0;
}
