#include <bits/stdc++.h>
using namespace std;
bool array1[105];
long long x, firstonlysolved, secondonlysolved;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tc;
  cin >> tc;
  for (int i = 1; i <= tc; i++) {
    cin >> array1[i];
  }
  for (int i = 1; i <= tc; i++) {
    cin >> x;
    if (!x and array1[i]) {
      firstonlysolved++;
    }
    if (x and !array1[i]) {
      secondonlysolved++;
    }
  }
  cout << ((firstonlysolved == 0) ? -1
                                  : secondonlysolved / firstonlysolved + 1);
  return 0;
}
