#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  int r[109];
  int b[109];
  for (int i = 1; i <= n; i++) {
    cin >> r[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  int rcnt = 0;
  int bcnt = 0;
  for (int i = 1; i <= n; i++) {
    if (r[i] == 1 && b[i] == 0)
      rcnt++;
    else if (r[i] == 0 && b[i] == 1)
      bcnt++;
  }
  if (rcnt == bcnt && rcnt == 0)
    cout << -1 << endl;
  else if (rcnt == 0)
    cout << -1 << endl;
  else {
    int x = bcnt % rcnt;
    int y = bcnt / rcnt;
    cout << y + 1 << endl;
  }
  return 0;
}
