#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 r[n], b[n], i, sum1 = 0, sum2 = 0, j;
  for (i = 0; i < n; ++i) cin >> r[i];
  for (i = 0; i < n; ++i) cin >> b[i];
  for (i = 0; i < n; ++i) {
    if (r[i] == b[i])
      continue;
    else
      break;
  }
  if (i == n)
    cout << -1;
  else {
    for (i = 1; i <= 1000; ++i) {
      sum1 = 0;
      sum2 = 0;
      for (j = 0; j < n; ++j) {
        if (r[j] == 1 && b[j] == 0)
          sum1 += i;
        else if (r[j] == 1 && b[j] == 1) {
          sum1 += 1;
          sum2 += 1;
        } else if (r[j] == 0 && b[j] == 1) {
          sum2 += 1;
        }
      }
      if (sum1 > sum2) break;
    }
    if (i == 1001)
      cout << -1;
    else
      cout << i;
  }
  return 0;
}
