#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, r[100], b[100], sumr, sumb, ans = 1, check = 1;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> r[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  sumr = accumulate(r, r + n, 0);
  sumb = accumulate(b, b + n, 0);
  if ((sumr == sumb && sumb == 0) || (sumr == sumb && sumb == n)) {
    cout << -1;
    return 0;
  }
  if (sumr > sumb) {
    cout << 1;
    return 0;
  }
  for (int i = 0; i < n; i++)
    if (r[i] && !b[i]) {
      check = 0;
      break;
    }
  if (check) {
    cout << -1;
    return 0;
  }
RELOOP:;
  ans++;
  for (int i = 0; i < n; i++)
    if (r[i] && !b[i]) sumr++;
  if (sumr <= sumb) goto RELOOP;
  cout << ans;
  return 0;
}
