#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const int OO = 0x3f3f3f3f, P = 100;
void g4(void) {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}
int main() {
  g4();
  long long int n, br[105], ar[105], b = 0, a = 0, f = 1;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> br[i];
  }
  for (long long int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (long long int i = 0; i < n; i++) {
    if (br[i]) f = 0;
    if (br[i] && ar[i]) continue;
    a += ar[i];
    b += br[i];
  }
  if ((a == 0 && b == 0) || (b == 0))
    cout << -1;
  else if (b > a)
    cout << 1;
  else
    cout << ceil((double)(a + 1) / (double)b);
  return 0;
}
