#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 3], b[n + 5];
  for (int i = 0; i < n; i++) cin >> a[i];
  int x = 0, y = 0, z = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (b[i] == a[i] == 1)
      x++;
    else if (b[i] == 1 && a[i] == 0)
      y++;
    else if (b[i] == 0 && a[i] == 1)
      z++;
  }
  if (z > y)
    cout << 1 << endl;
  else if ((y == z && y == 0) || z == 0)
    cout << -1 << endl;
  else if (y >= z) {
    y++;
    if (y % z == 0)
      cout << y / z << endl;
    else
      cout << (y / z) + 1 << endl;
  }
  return 0;
}
