#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9 + 7;
const ll inf = 1e9 + 5;
int main() {
  int n, x1 = 0, y1 = 0, e = 0;
  cin >> n;
  int r[n], b[n];
  for (int i = 0; i < n; i++) cin >> r[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (r[i] > b[i])
      x1++;
    else if (r[i] < b[i])
      y1++;
    else
      e++;
  }
  if (e == n || x1 == 0)
    cout << -1;
  else if (x1 > y1)
    cout << 1;
  else
    cout << y1 / x1 + 1;
}
