#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int probs;
  cin >> probs;
  long long int points[2][probs];
  long long int count = 0;
  long long int count2 = 0;
  for (long long int i = 0; i < 2; i++) {
    for (long long int j = 0; j < probs; j++) {
      cin >> points[i][j];
      if (i == 1) {
        if (points[i][j] == 1 && points[i - 1][j] == 0) {
          count++;
        } else if (points[i][j] == 0 && points[i - 1][j] == 1) {
          count2++;
        }
      }
    }
  }
  if (count2 == 0) {
    cout << -1;
  } else {
    cout << ceil((float)(count + 1) / count2);
  }
  return 0;
}
