#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (long long &i : a) cin >> i;
  for (long long &i : b) cin >> i;
  long long need = 0;
  for (long long i = 0; i < n; ++i) {
    need += (a[i] < b[i]);
  }
  long long have = 0;
  for (long long i = 0; i < n; ++i) have += (a[i] > b[i]);
  if (have == 0) {
    cout << -1 << '\n';
  } else {
    cout << (need + have) / have << '\n';
  }
  return 0;
}
