#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    arr[i] -= x;
  }
  int B = 0, R = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] == -1)
      B++;
    else if (arr[i] == 1)
      R++;
  }
  if (B == 0) {
    if (R == 0) {
      cout << "-1";
    }
    if (R != 0) {
      cout << "1";
    }
  } else if (R == 0) {
    cout << "-1";
  } else {
    cout << B / R + 1;
  }
  cout << '\n';
}
