#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int arr1[n], arr2[n];
  for (int i = 0; i < n; i++) {
    cin >> arr1[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> arr2[i];
  }
  int ncount = 0, pcount = 0;
  for (int i = 0; i < n; i++) {
    if (arr1[i] - arr2[i] == -1) ncount++;
    if (arr1[i] - arr2[i] == 1) pcount++;
  }
  if (pcount == 0) {
    cout << -1;
    return 0;
  }
  int ans = ceil(((float)ncount + 1) / (float)pcount);
  cout << ans;
  return 0;
}
