#include <bits/stdc++.h>
using namespace std;
int a[110], b[110];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  int cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == b[i]) continue;
    if (a[i] == 1)
      cnt1++;
    else
      cnt2++;
  }
  if ((cnt1 == cnt2 && cnt2 == 0) || cnt1 == 0)
    cout << -1 << endl;
  else
    cout << (cnt2 + cnt1) / cnt1 << endl;
  return 0;
}
