#include <bits/stdc++.h>
using namespace std;
bool k(const int a, const int b) { return abs(a) < abs(b); }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {}
int ans, ans2, sum1, sum2, cnt;
int main() {
  int n;
  cin >> n;
  vector<int> v1(n), v2(n);
  for (int& i : v1) cin >> i;
  for (int& i : v2) cin >> i;
  for (int i = 0; i < n; i++) {
    if (v1[i] && !v2[i])
      cnt++;
    else
      sum1 += v1[i];
    sum2 += v2[i];
  }
  if (cnt)
    ans = ceil(double(sum2 - sum1 + 1) / cnt);
  else
    ans = -1;
  cout << ans;
  return 0;
}
