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