#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  long long b[n];
  long long robo = 0;
  long long bionic = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long j = 0; j < n; j++) {
    cin >> b[j];
    if (a[j] == 0 && b[j] == 1) {
      bionic++;
    } else if (a[j] == 1 && b[j] == 0) {
      robo++;
    }
  }
  if (robo == 0 && bionic == 0) {
    cout << -1 << endl;
  } else if (robo > bionic) {
    cout << 1;
  } else if (robo == 0) {
    cout << -1;
  } else {
    bionic++;
    while (bionic % robo != 0) {
      bionic++;
    }
    cout << bionic / robo << endl;
  }
  return 0;
}
