#include <bits/stdc++.h>
using namespace std;
int n, a[105], b[105];
inline int solve() {
  int q, w;
  q = w = 0;
  for (int i = 1; i <= n; ++i)
    if (a[i] ^ b[i]) q += a[i], w += b[i];
  if (!q) return -1;
  return w / q + 1;
}
int main() {
  {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  cout << solve() << "\n";
  return 0;
}
