Polycarp is preparing the first programming contest for robots. There are $n$ problems in it, and a lot of robots are going to participate in it. Each robot solving the problem $i$ gets $p_i$ points, and the score of each robot in the competition is calculated as the sum of $p_i$ over all problems $i$ solved by it. For each problem, $p_i$ is an integer not less than $1$.

Two corporations specializing in problem-solving robot manufacturing, "Robo-Coder Inc." and "BionicSolver Industries", are going to register two robots (one for each corporation) for participation as well. Polycarp knows the advantages and flaws of robots produced by these companies, so, for each problem, he knows precisely whether each robot will solve it during the competition. Knowing this, he can try predicting the results — or manipulating them. 

For some reason (which absolutely cannot involve bribing), Polycarp wants the "Robo-Coder Inc." robot to outperform the "BionicSolver Industries" robot in the competition. Polycarp wants to set the values of $p_i$ in such a way that the "Robo-Coder Inc." robot gets strictly more points than the "BionicSolver Industries" robot. However, if the values of $p_i$ will be large, it may look very suspicious — so Polycarp wants to minimize the maximum value of $p_i$ over all problems. Can you help Polycarp to determine the minimum possible upper bound on the number of points given for solving the problems?


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 100$) — the number of problems.

The second line contains $n$ integers $r_1$, $r_2$, ..., $r_n$ ($0 \le r_i \le 1$). $r_i = 1$ means that the "Robo-Coder Inc." robot will solve the $i$-th problem, $r_i = 0$ means that it won't solve the $i$-th problem.

The third line contains $n$ integers $b_1$, $b_2$, ..., $b_n$ ($0 \le b_i \le 1$). $b_i = 1$ means that the "BionicSolver Industries" robot will solve the $i$-th problem, $b_i = 0$ means that it won't solve the $i$-th problem.


-----Output-----

If "Robo-Coder Inc." robot cannot outperform the "BionicSolver Industries" robot by any means, print one integer $-1$.

Otherwise, print the minimum possible value of $\max \limits_{i = 1}^{n} p_i$, if all values of $p_i$ are set in such a way that the "Robo-Coder Inc." robot gets strictly more points than the "BionicSolver Industries" robot.


-----Examples-----
Input
5
1 1 1 0 0
0 1 1 1 1

Output
3

Input
3
0 0 0
0 0 0

Output
-1

Input
4
1 1 1 1
1 1 1 1

Output
-1

Input
9
1 0 0 0 0 0 0 0 1
0 1 1 0 1 1 1 1 0

Output
4



-----Note-----

In the first example, one of the valid score assignments is $p = [3, 1, 3, 1, 1]$. Then the "Robo-Coder" gets $7$ points, the "BionicSolver" — $6$ points.

In the second example, both robots get $0$ points, and the score distribution does not matter.

In the third example, both robots solve all problems, so their points are equal.

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
import string

def main():
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	more = 0
	less = 0
	for i in range(n):
		if r[i] > b[i]:
			more += 1
		elif r[i] < b[i]:
			less += 1
	if more == 0:
		print(-1)
		return
	a = less / more + 1
	print(int(a))

def __starting_point():
	t = 1
	for i in range(t):
		main()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p1 = 0
p2 = 0
k = 0
f = 0
if a == b:
	print(-1)
else:
	for i in range(n):
		if a[i] == 0 and b[i] == 0:
			pass
		elif a[i] == 0 and b[i] == 1:
			p2 = p2 + 1
		elif a[i] == 1 and b[i] == 1:
			p1 = p1 + 1
			p2 = p2 + 1
		else:
			k = k + 1
	for j in range(1, 1000):
		if k * j + p1 > p2:
			print(j)
			f = 1
			break
	if f == 0:
		print(-1)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
diff = [a[i] - b[i] for i in range(n)]
x = diff.count(1)
y = diff.count(-1)
if x == 0:
	print(-1)
else:
	print(math.ceil((y + 1) / x))


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n,) = I()
r = I()
b = I()
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		break
else:
	print(-1)
	exit()
p = [1] * n
idx = 0
ok = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		idx += 1
	elif b[i] == 1 and r[i] == 0:
		ok += 1
rsum = sum(r)
bsum = sum(b)
ans = 1
while rsum <= bsum:
	ans += 1
	rsum += idx
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
rc = 0
bs = 0
for i in range(0, len(a)):
	if a[i] != b[i]:
		if a[i] == 1:
			rc += 1
		else:
			bs += 1
if rc == 0 and bs == 0 or (rc == 0 and bs > 0):
	print('-1')
else:
	print(str(math.ceil((bs + 1) / rc)))


n = int(input())
robotA = [int(i) for i in str(input()).split()]
robotB = [int(i) for i in str(input()).split()]
pA = 0
pB = 0
pC = 0
for i in range(n):
	if robotA[i] == 1 and robotB[i] != 1:
		pA += 1
	if robotA[i] != 1 and robotB[i] == 1:
		pB += 1
if pA == 0:
	print(-1)
else:
	ans = int(pB / pA) + 1
	print(ans)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
a = 0
be = 0
c = 0
d = 0
for i in range(0, n):
	if r[i] == 1 and b[i] == 1:
		c += 1
	if r[i] == 1 and b[i] == 0:
		a += 1
	if r[i] == 0 and b[i] == 1:
		be += 1
	if r[i] == 0 and b[i] == 0:
		d += 1
if c + d == n:
	ans = -1
elif a > be:
	ans = 1
elif a == be:
	ans = 2
elif a == 0:
	ans = -1
elif a < be:
	x = be + 1
	if x / a == int(x / a):
		ans = int(x / a)
	else:
		ans = int(x / a) + 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
i = 0
c = []
while i < n:
	c.append(a[i] - b[i])
	i += 1
k = c.count(-1)
kk = c.count(1)
try:
	print(k // kk + 1)
except ZeroDivisionError:
	print(-1)


def main():
	k = input()
	r = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	r_set = set({i for i in range(len(r)) if r[i] == 1})
	b_set = set({i for i in range(len(b)) if b[i] == 1})
	l = r_set.intersection(b_set)
	diff_r = r_set.difference(b_set)
	diff_b = b_set.difference(r_set)
	n = len(diff_b)
	m = len(diff_r)
	if m != 0:
		if (n + 1) % m == 0:
			print((n + 1) // m)
		else:
			print((n + 1) // m + 1)
	else:
		print(-1)
main()


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
r1 = 0
b1 = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		b1 += 1
	elif r[i] == 1 and b[i] == 0:
		r1 += 1
if r1 == 0:
	print(-1)
elif r1 > b1:
	print(1)
elif r1 == b1:
	print(2)
else:
	print((b1 - r1) // r1 + 2)


from math import *
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
pos = 0
neg = 0
csum = 0
possible = False
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		pos += 1
	if b[i] == 1 and r[i] == 0:
		neg += 1
if pos == 0:
	print(-1)
elif neg == 0:
	print(1)
else:
	print(int(ceil((neg + 1) / pos)))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		b = LI()
		c = d = 0
		for (e, f) in zip(a, b):
			if e > f:
				c += 1
			elif f > e:
				d += 1
		if c == 0:
			rr.append(-1)
		elif d == 0:
			rr.append(1)
		else:
			rr.append((d + c) // c)
	return JA(rr, '\n')
print(main())


n = int(input())
l = list(map(int, input().split()))
k = list(map(int, input().split()))
ans = 0
l1 = sum(l)
k1 = sum(k)
if l1 == k1 and k1 == 0:
	print(-1)
elif l1 == k1 and l1 == n:
	print(-1)
else:
	f = 0
	for t in range(n):
		if l[t] == 1 and k[t] == 0:
			f += 1
	if f == 0:
		print(-1)
	else:
		j = k1 + f - l1
		g = j // f
		if g * f <= j:
			g += 1
		print(g)


import sys
n = int(sys.stdin.readline())
R = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
RnB = sum([R[i] and (not B[i]) for i in range(n)])
BnR = sum([B[i] and (not R[i]) for i in range(n)])
if not RnB:
	print(-1)
else:
	print(BnR // RnB + 1)


n = int(input())
r = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
diff_probs = 0
least_points = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		diff_probs += 1
	elif r[i] == 0 and b[i] == 1:
		least_points += 1
if diff_probs == 0:
	print(-1)
else:
	print(least_points // diff_probs + 1)


from math import floor
n = int(input())
robo = input().split(' ')
bionic = input().split(' ')
r = 0
b = 0
for i in range(n):
	if robo[i] == '1' and bionic[i] == '0':
		r += 1
	elif robo[i] == '0' and bionic[i] == '1':
		b += 1
	else:
		pass
if r != 0:
	print(int(floor(b / r + 1)))
else:
	print(-1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
R = 0
B = 0
for i in range(n):
	if r[i] > b[i]:
		R += 1
	elif r[i] < b[i]:
		B += 1
if R == 0:
	print(-1)
else:
	print(B // R + 1)


n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
r_points = 0
b_points = 0
flag = 1
for ind in range(n):
	if r[ind] == 1 and b[ind] == 0:
		flag = 0
		r_points += 1
	if r[ind] == 0 and b[ind] == 1:
		b_points += 1
if flag == 0:
	if r_points > b_points:
		print(1)
	else:
		counter = 1
		add = r_points
		while r_points <= b_points:
			r_points += add
			counter += 1
		print(counter)
else:
	print(-1)


n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
only_r_solve = 0
only_b_solve = 0
for i in range(n):
	if r[i] and (not b[i]):
		only_r_solve += 1
	elif b[i] and (not r[i]):
		only_b_solve += 1
if only_r_solve == 0:
	ans = -1
else:
	only_b_solve += 1
	ans = only_b_solve // only_r_solve
	if only_b_solve % only_r_solve != 0:
		ans += 1
print(ans)


a = int(input())
firstrobo = input().split()
secrobo = input().split()
winner = 0
loser = 0
for i in range(a):
	if firstrobo[i] == '1' and secrobo[i] == '0':
		winner = winner + 1
	if firstrobo[i] == '0' and secrobo[i] == '1':
		loser = loser + 1
if winner == 0:
	print(-1)
else:
	print(int(loser / winner + 1))


from math import ceil

def set_score(n, r_solved, b_solved):
	r_sum = 0
	b_sum = 0
	for i in range(0, n):
		if r_solved[i] > b_solved[i]:
			r_sum += 1
		elif r_solved[i] < b_solved[i]:
			b_sum += 1
	if r_sum == 0:
		return -1
	return ceil((b_sum + 1) / r_sum)
num_cases = int(input())
r_solved = input().split(' ')
b_solved = input().split(' ')
for i in range(0, len(r_solved)):
	r_solved[i] = int(r_solved[i])
	b_solved[i] = int(b_solved[i])
print(set_score(num_cases, r_solved, b_solved))


import sys
n = sys.stdin.readline()
r = tuple(map(int, sys.stdin.readline().split()))
b = tuple(map(int, sys.stdin.readline().split()))
(r_s, b_s) = (0, 0)
for (i, r_i) in enumerate(r):
	if r_i != b[i]:
		r_s += r_i
		b_s += b[i]
if r_s == 0:
	sys.stdout.write('-1\n')
elif b_s == 0:
	sys.stdout.write('1\n')
else:
	(q, r) = divmod(b_s + 1, r_s)
	sys.stdout.write(f'{q + (r != 0)}\n')
sys.stdout.flush()


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
s = 0
x = 0
y = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		s += 1
	x += r[i]
	y += b[i]
if r == b:
	print('-1')
elif s == 0:
	print('-1')
elif x > y:
	print('1')
else:
	a = y + s - x + 1
	if a % s == 0:
		print(a // s)
	else:
		print(a // s + 1)


def more():
	return map(int, input().split())
n = int(input())
r = list(more())
b = list(more())
count = 0
inc = 0
for i in range(n):
	if r[i] == b[i]:
		continue
	if r[i] == 0 and b[i] == 1:
		count += 1
	if r[i] == 1 and b[i] == 0:
		inc += 1
if inc == 0:
	print(-1)
elif count % inc == 0:
	print(count // inc + 1)
else:
	print(count // inc + 1)


import math
problems = int(input())
robo = list(map(int, input().split()))
bionic = list(map(int, input().split()))
x = 0
y = 0
if robo == bionic:
	print(-1)
else:
	for (i, j) in zip(robo, bionic):
		if i == 1 and j == 0:
			x += 1
		if i == 0 and j == 1:
			y += 1
	if x == 0:
		print(-1)
	else:
		print(math.ceil((y + 1) / x))


import math

def swape(n, r, b):
	rc = r.count(1)
	bc = b.count(1)
	if bc == n or rc == 0 or r == b:
		return -1
	if rc > bc:
		return 1
	temp = 0
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			temp += 1
	ans = math.ceil((bc - rc + 1) / temp) + 1
	return ans
n = int(input())
r = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
ans = swape(n, r, b)
print(ans)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	r = lis()
	b = lis()
	rcnt = 0
	bcnt = 0
	for i in range(n):
		if r[i] == b[i]:
			continue
		elif r[i] == 1:
			rcnt += 1
		else:
			bcnt += 1
	if rcnt == 0:
		print(-1)
		return
	print(ceil((bcnt + 1) / rcnt))
testcase(1)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
lst1 = get_int_list()
lst2 = get_int_list()
count1 = count2 = 0
for i in range(n):
	if lst1[i] == 1 and lst2[i] == 0:
		count1 += 1
	if lst1[i] == 0 and lst2[i] == 1:
		count2 += 1
if count1 == 0 and count2 == 0:
	print(-1)
elif count1 > 0:
	mi = math.floor(count2 / count1) + 1
	print(mi)
else:
	print(-1)


input()
x = y = 0
for (r, b) in zip(input().split(), input().split()):
	if r + b == '10':
		x += 1
	elif r + b == '01':
		y += 1
print(1 + y // x if x else -1)


from math import ceil
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
s1 = 0
s2 = 0
c = 0
x = 0
for i in range(n):
	if r[i] == b[i]:
		x = x + 1
	if b[i] == 1:
		s1 = s1 + r[i]
		s2 = s2 + b[i]
	if r[i] == 1 and b[i] == 0:
		c = c + 1
if c == 0:
	print(-1)
elif s1 > s2:
	print(1)
else:
	y = s2 - s1 + 1
	print(ceil(y / c))


am = int(input())
me = list(map(int, input().split()))
notMe = list(map(int, input().split()))
mq = 0
nmq = 0
for i in range(am):
	if me[i] == 0 and notMe[i] == 1:
		nmq += 1
	elif me[i] == 1 and notMe[i] == 0:
		mq += 1
if mq == 0:
	print(-1)
else:
	print(nmq // mq + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = 0
b1 = 0
for i in range(n):
	if a[i] == 0 and b[i] == 1:
		b1 += 1
	elif a[i] == 1 and b[i] == 0:
		a1 += 1
if a1 == 0:
	print(-1)
elif a1 > b1:
	print(1)
elif a1 == b1:
	print(2)
else:
	print(b1 // a1 + 1)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
if r == b or (r != b and r.count(0) == len(r)):
	print(-1)
else:
	y = 0
	x = 0
	yep = False
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			x += 1
			yep = True
		elif r[i] == 0 and b[i] == 1:
			y += 1
	if yep:
		p = math.ceil((y + 1) / x)
		print(p)
	else:
		print(-1)


n = int(input())
a = []
b = []
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c1 = c2 = 0
for i in range(0, n):
	if a[i] == 1 and b[i] == 0:
		c1 = c1 + 1
	elif a[i] == 0 and b[i] == 1:
		c2 = c2 + 1
if c1 == 0:
	print(-1)
else:
	print(c2 // c1 + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
numR = 0
numB = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		numB += 1
	elif r[i] == 1 and b[i] == 0:
		numR += 1
if numR == 0:
	print(-1)
else:
	ans = numB + 1
	if ans % numR != 0:
		print(ans // numR + 1)
	else:
		print(ans // numR)


n = int(input())
f = list(map(int, input().split()))
s = list(map(int, input().split()))
mo_f = 0
mo_s = 0
for i in range(n):
	if f[i] > s[i]:
		mo_f += 1
	elif s[i] > f[i]:
		mo_s += 1
if mo_f == 0:
	print(-1)
else:
	print(mo_s // mo_f + 1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
same = True
c1 = 0
c2 = 0
for i in range(n):
	if l1[i] != l2[i]:
		same = False
		if l2[i] > l1[i]:
			c2 = c2 + 1
		else:
			c1 = c1 + 1
if same == True:
	print(-1)
elif c1 != 0:
	print(c2 // c1 + 1)
else:
	print(-1)


n = int(input())
robo = list(map(int, input().split(' ')))
bion = list(map(int, input().split(' ')))
rp = 0
bp = 0
all_equal = True
for i in range(n):
	if robo[i] != bion[i]:
		all_equal = False
		if robo[i] > bion[i]:
			rp += 1
		elif robo[i] < bion[i]:
			bp += 1
if all_equal or rp == 0:
	ans = -1
elif rp > bp:
	ans = 1
else:
	bp += 1
	ans = int(bp / rp)
	if bp % rp != 0:
		ans += 1
print(ans)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
diff = [i for i in range(len(r)) if r[i] == 1 and b[i] != 1]
inv_diff = [i for i in range(len(r)) if r[i] != 1 and b[i] == 1]
if len(diff) == 0:
	print(-1)
else:
	print(math.ceil((len(inv_diff) + 1) / len(diff)))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(cn, nc) = (0, 0)
for i in range(n):
	if a[i] and (not b[i]):
		cn += 1
	elif not a[i] and b[i]:
		nc += 1
if not cn:
	print(-1)
else:
	print((nc + cn) // cn)


a = int(input())
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
count = 0
count1 = 0
for i in range(0, a):
	if b[i] == 1 and c[i] == 0:
		count += 1
	elif b[i] == 0 and c[i] == 1:
		count1 += 1
if count == 0:
	print('-1')
elif count > count1:
	print('1')
else:
	c = count1 // count
	print(c + 1)


input()
a = b = 0
for (x, y) in zip(input(), input()):
	a += x > y
	b += x < y
print(-1 if a == 0 else b // a + 1)


def robo_contest(n, robo1, robo2):
	if robo1 == robo2:
		return -1
	if sum(robo1) > sum(robo2):
		return 1
	else:
		cond = True
		list_i = []
		for i in range(n):
			if robo1[i] == 1 and robo2[i] == 0:
				list_i.append(i)
				cond = False
		if cond:
			return -1
		return inc(1, list_i, robo1, robo2)

def inc(count, list_i, robo1, robo2):
	for i in list_i:
		robo1[i] += 1
	count += 1
	if sum(robo1) > sum(robo2):
		return count
	else:
		return inc(count, list_i, robo1, robo2)
n = int(input())
robo1 = list(map(int, input().split()))
robo2 = list(map(int, input().split()))
print(robo_contest(n, robo1, robo2))


T = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
(win, loss) = (0, 0)
for i in range(T):
	if a[i] > b[i]:
		win += 1
	elif a[i] < b[i]:
		loss += 1
if win == 0:
	print(-1)
else:
	print(loss // win + 1)


import math
n = int(input())
robo = list(map(int, input().split()))
bionic = list(map(int, input().split()))
only_bionic = only_robo = 0
if not 1 in robo or sum(bionic) == n:
	print(-1)
else:
	for i in range(n):
		if robo[i] == 1 and bionic[i] == 0:
			only_robo += 1
		elif bionic[i] == 1 and robo[i] == 0:
			only_bionic += 1
	if only_robo >= 1:
		print(math.ceil((only_bionic + 1) / only_robo))
	else:
		print(-1)


n = int(input())
rlist = list(map(int, input().split()))
blist = list(map(int, input().split()))
asum = 1
count = 0
for i in range(n):
	if rlist[i] == 0 and blist[i] == 1:
		asum += 1
	if rlist[i] == 1 and blist[i] == 0:
		count += 1
if count == 0:
	print(-1)
else:
	print(-(-asum // count))


n = int(input())
a = input().replace(' ', '')
b = input().replace(' ', '')
x = y = 0
for i in range(n):
	x += a[i] > b[i]
	y += a[i] < b[i]
if x == 0:
	print(-1)
elif x > y:
	print(1)
else:
	print(y // x + 1)


from sys import stdin, stdout
import math
n = int(stdin.readline().rstrip())
r = list(map(int, stdin.readline().rstrip().split(' ')))
b = list(map(int, stdin.readline().rstrip().split(' ')))
rWins = 0
bWins = 0
for ii in range(n):
	if r[ii] > b[ii]:
		rWins += 1
	elif b[ii] > r[ii]:
		bWins += 1
if rWins == 0:
	print(-1)
elif rWins > bWins:
	print(1)
else:
	print(math.ceil((bWins + 1) / rWins))


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rt = 0
bt = 0
for i in range(n):
	if r[i] != b[i]:
		if r[i] > b[i]:
			rt += 1
		else:
			bt += 1
if rt > bt:
	print('1')
elif rt == 0:
	print('-1')
elif bt % rt == 0:
	print(bt // rt + 1)
else:
	print((bt + (rt - bt % rt)) // rt)


import math
n = int(input(''))
r = input('').split(' ')
b = input('').split(' ')
x = 0
y = 0
for i in range(0, len(r)):
	if b[i] == '1' and r[i] == '0':
		y += 1
	if b[i] == '0' and r[i] == '1':
		x += 1
if x == 0:
	print(-1)
else:
	print(math.ceil((y + 1) / x))


input()
n1 = 0
n2 = 0
nc = 0
for (v1, v2) in zip(map(int, input().split()), map(int, input().split())):
	n1 += v1
	n2 += v2
	nc += v1 * v2
n1 -= nc
n2 -= nc
if n1 == 0:
	print(-1)
elif n1 > n2:
	print(1)
else:
	print(n2 // n1 + 1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
(c1, c2) = (0, 0)
for i in range(n):
	if l1[i] > l2[i]:
		c1 += 1
	elif l1[i] < l2[i]:
		c2 += 1
if c1 == 0:
	print(-1)
elif c1 > c2:
	print(1)
else:
	print(min(c2 - c1 + 2, c2 // c1 + 1))


n = int(input())
rs = list(map(int, input().split()))
bs = list(map(int, input().split()))
rcount = 0
bcount = 0
for i in range(n):
	if rs[i] == 1 and bs[i] != 1:
		rcount += 1
	if rs[i] != 1 and bs[i] == 1:
		bcount += 1
if rcount == 0:
	print(-1)
else:
	res = (bcount + 1) // rcount
	if (bcount + 1) % rcount != 0:
		res += 1
	print(res)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
countr = 0
countb = 0
for i in range(n):
	if r[i] > b[i]:
		countr += 1
	elif r[i] < b[i]:
		countb += 1
if countr == 0:
	print(-1)
else:
	ans = countb // countr + 1
	print(ans)


import math
number_of_problems = int(input())
rclist = list(map(int, input().split(' ')))
BSlist = list(map(int, input().split(' ')))
rc_wins = 0
bs_wins = 0
for i in range(number_of_problems):
	a = rclist[i]
	b = BSlist[i]
	if a > b:
		rc_wins = rc_wins + 1
	elif b > a:
		bs_wins = bs_wins + 1
if rc_wins == 0:
	print(-1)
else:
	print(math.ceil((bs_wins + 1) / rc_wins))


import sys
input = lambda : sys.stdin.readline().rstrip()
n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
r1 = 0
b1 = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		r1 += 1
	elif r[i] == 0 and b[i] == 1:
		b1 += 1
if r1 == 0:
	print(-1)
else:
	print(b1 // r1 + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(am, bm) = (0, 0)
for i in range(n):
	if a[i] and b[i] == 0:
		am += 1
	if b[i] and a[i] == 0:
		bm += 1
if am:
	print(bm // am + 1)
else:
	print(-1)


n = int(input())
r = [int(s) for s in input().split(' ')]
b = [int(s) for s in input().split(' ')]
wins = 0
losses = 0
for i in range(n):
	if r[i] < b[i]:
		losses += 1
	elif r[i] > b[i]:
		wins += 1
if wins == 0:
	ans = -1
else:
	ans = losses // wins + 1
print(ans)


n = int(input())
li_1 = list(map(int, input().split(' ')))
li_2 = list(map(int, input().split(' ')))
psb = 0
psbn = 0
ps_1 = 0
ps_2 = 0
for i in range(n):
	if li_1[i] == li_2[i]:
		if li_1[i] == 1:
			psb += 1
		else:
			psbn += 1
	elif li_1[i] == 1:
		ps_1 += 1
	else:
		ps_2 += 1
ps_1f = ps_1 + psb
ps_2f = ps_2 + psb
if psb + psbn == n:
	print(-1)
elif ps_1 > ps_2:
	print(1)
elif ps_1 == 0:
	print(-1)
else:
	ans = (ps_2 + 1) // ps_1
	if (ps_2 + 1) % ps_1 == 0:
		print(ans)
	else:
		print(ans + 1)


n = int(input())
ra = map(int, input().split())
ba = map(int, input().split())
badv = 0
rchn = 0
for (rv, bv) in zip(ra, ba):
	if rv == 0 and bv == 1:
		badv += 1
	elif rv == 1 and bv == 0:
		rchn += 1
if rchn == 0:
	print(-1)
elif badv == 0:
	print(1)
else:
	rwin = badv + 1
	if rwin % rchn != 0:
		print(1 + int(rwin / rchn))
	else:
		print(rwin // rchn)


n = int(input())
r = input().split()
b = input().split()
R = 0
B = 0
for x in range(n):
	if int(r[x]) > int(b[x]):
		R = R + 1
	if int(r[x]) < int(b[x]):
		B = B + 1
if R == 0:
	print(-1)
else:
	x = B / R
	if x > int(x):
		print(int(x) + 1)
	else:
		x = int(x)
		print(x + 1)


from math import ceil
N = int(input())
(A, B) = [list(map(int, input().split())) for _ in (1, 2)]
n = len([i for i in range(N) if A[i] > B[i]])
m = len([i for i in range(N) if A[i] < B[i]])
print(ceil((m + 1) / n) if n > 0 else -1)


n = int(input())
(a, b) = (input().split(), input().split())
for i in range(n):
	if a[i] == b[i]:
		a[i] = b[i] = 0
try:
	print(b.count('1') // a.count('1') + 1)
except:
	print(-1)


n = int(input())
roboc = list(map(int, input().split()))
bionic = list(map(int, input().split()))
rcount = 0
bcount = 0
csame = 0
for i in range(n):
	if roboc[i] > bionic[i]:
		rcount += 1
	elif roboc[i] < bionic[i]:
		bcount += 1
	else:
		csame += 1
import math
ans = -1
if csame == n:
	ans = -1
elif rcount == 0:
	ans = -1
else:
	ans = math.ceil((bcount + 1) / rcount)
print(ans)


from sys import stdin
import math
n = int(stdin.readline())
r = list(map(int, stdin.readline().split()))
b = list(map(int, stdin.readline().split()))
robo = sum(r)
bionic = sum(b)
c = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		c += 1
if c:
	print(math.ceil((bionic - robo + 1) / c + 1))
else:
	print(-1)


from math import *
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rn = bn = 0
for x in range(n):
	if r[x] > b[x]:
		rn += 1
	elif b[x] > r[x]:
		bn += 1
if rn == 0:
	print(-1)
else:
	print(ceil((bn + 1) / rn))


import sys
lines = sys.stdin.readlines()
N = int(lines[0])
temp = 0
A = list(map(int, lines[1].strip().split(' ')))
B = list(map(int, lines[2].strip().split(' ')))
c = 0
d = 0
for i in range(N):
	if A[i] == 0 and B[i] == 1:
		d += 1
	elif A[i] == 1 and B[i] == 0:
		c += 1
if c == 0:
	print(-1)
else:
	print((c + d) // c)


n = int(input())
a1 = list(map(int, input().split()))
b1 = list(map(int, input().split()))
c = []
for i in range(n):
	c.append(a1[i] - b1[i])
sm1 = 0
sm11 = 0
for i in range(n):
	if c[i] == 1:
		sm1 += 1
	elif c[i] == -1:
		sm11 += 1
if sm1 == 0:
	print(-1)
else:
	print(1 + sm11 // sm1)


from collections import Counter
from collections import defaultdict
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
diff = 0
for i in range(0, n):
	if a[i] == 1 and b[i] == 0:
		c = c + 1
	if a[i] == 0 and b[i] == 1:
		diff = diff + 1
diff = diff + 1
if c == 0:
	print(-1)
elif a.count(1) > b.count(1):
	print(1)
else:
	print(math.ceil(diff / c))


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
r_score = r.count(1)
b_score = b.count(1)
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		cnt += 1
if r_score > b_score:
	print(1)
elif cnt == 0:
	print(-1)
else:
	plus = b_score - r_score + 1
	print(-(-plus // cnt) + 1)


import sys
I = lambda : int(input())
readline = lambda : sys.stdin.readline().strip('\n')
readmap = lambda x=int: map(x, readline().split(' '))
RM = readmap
from math import ceil
(n, a, b) = (I(), [*RM()], [*RM()])
(count1, count2) = (0, 1)
for (i, j) in zip(a, b):
	count1 += i and j == 0
	count2 += j and i == 0
print(ceil(count2 / count1) if count1 else -1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
r = 0
b = 0
for i in range(n):
	if l1[i] == 0 and l2[i] == 1:
		b += 1
	elif l1[i] == 1 and l2[i] == 0:
		r += 1
if r == 0:
	print(-1)
elif r > b:
	print(1)
elif (b + 1) % r == 0:
	print((b + 1) // r)
else:
	print((b + 1) // r + 1)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
diff = sum(b) - sum(r)
alr = 0
alb = 0
for i in range(n):
	if b[i] == 0 and r[i] == 1:
		alr += 1
	if b[i] == 1 and r[i] == 0:
		alb += 1
if alr == 0:
	print(-1)
else:
	print(alb // alr + 1)


n = int(input())
l = list(map(int, input().split()))
k = list(map(int, input().split()))
x = 0
y = 0
for i in range(len(k)):
	if l[i] != k[i] and l[i] > 0:
		x = x + 1
	elif l[i] != k[i] and k[i] > 0:
		y = y + 1
if x == 0:
	print('-1')
else:
	print(y // x + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
(c1, c2) = (0, 0)
for i in range(n):
	if r[i] and (not b[i]):
		c1 += 1
	elif not r[i] and b[i]:
		c2 += 1
if c1:
	print((c2 + c1) // c1)
else:
	print(-1)


for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ans = 0
	k = 0
	for i in range(n):
		if a[i] + b[i] != 2:
			if a[i] == 1:
				ans += 1
			elif b[i] == 1:
				k += 1
	if ans == 0:
		print(-1)
	elif k % ans == 0:
		print(k // ans + 1)
	else:
		print(k // ans + 1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
s = 0
r = 0
for i in range(n):
	if l1[i] == 1 and l2[i] == 0:
		s = s + 1
	elif l1[i] == 0 and l2[i] == 1:
		r = r + 1
if s == r:
	if s == 0:
		print(-1)
	else:
		print(2)
elif s > r:
	print(1)
elif s != 0:
	c = r // s + 1
	print(c)
else:
	print(-1)


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	pa = 0
	pb = 0
	only_a = 0
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			only_a += 1
		else:
			pa += a[i]
			pb += b[i]
	ans = -1
	if only_a > 0:
		ans = math.floor((pb - pa) / only_a) + 1
	print(ans)
t = 1
for _ in range(t):
	main()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
if a == b:
	print('-1')
else:
	for i in range(n):
		c.append(a[i] - b[i])
	if 1 in c:
		m = c.count(-1) / c.count(1) + 1
		print(int(m))
	else:
		print('-1')


i = 0
m = 0
mm = 0
n = int(input())
a = []
b = []
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
while i < n:
	x = a[i]
	y = b[i]
	if x == 1 and y == 0:
		m += 1
	if x == 0 and y == 1:
		mm += 1
	i += 1
if m == 0:
	print(-1)
else:
	print(int(mm / m + 1))


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
n = sInt()
a = lInt()
b = lInt()
ans = 0
val = 0
for i in range(n):
	if a[i] == b[i]:
		pass
	elif a[i] > b[i]:
		val += 1
	else:
		ans += 1
if val == 0:
	print(-1)
else:
	print(ans // val + 1)


import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
p = 0
q = 0
for (a, b) in zip(A, B):
	if a == 1 and b == 0:
		p += 1
	elif a == 0 and b == 1:
		q += 1
if p == 0:
	print(-1)
else:
	print((q + p) // p)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
z = sum(a)
z1 = sum(b)
if z > z1:
	print(1)
elif z == 0 or (z == 0 and z1 == 0) or (z == n and z1 == n):
	print(-1)
else:
	from math import ceil as q
	a = sum((1 for i in range(n) if a[i] == 1 and b[i] == 1))
	c = z - a
	c1 = z1 - a
	if c == 0:
		print(-1)
	else:
		print(q(c1 / c) + [0, 1][c1 % c == 0])


n = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(j) for j in input().split()]
l3 = []
l4 = []
c = 0
for i in range(n):
	if l1[i] == l2[i]:
		c += 1
		continue
	else:
		l3.append(l1[i])
		l4.append(l2[i])
if c == n:
	print(-1)
elif l3.count(1) != 0:
	print(int(sum(l4) / l3.count(1)) + 1)
else:
	print(-1)


n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
arr = []
c1 = 0
c2 = 0
temp1 = 0
temp2 = 0
for i in range(n):
	if arr1[i] == 1:
		c1 = c1 + 1
	if arr2[i] == 1:
		c2 = c2 + 1
	if arr1[i] == 1 and arr1[i] != arr2[i]:
		temp1 += 1
	elif arr2[i] == 1 and arr1[i] != arr2[i]:
		temp2 += 1
c1 = temp2 - temp1
if c1 < 0:
	print(1)
elif temp1 == 0:
	print(-1)
else:
	c1 = c1 // temp1 + 2
	print(c1)


n = int(input())
a = [int(l) for l in input().split()]
b = [int(l) for l in input().split()]
unfav = 0
fav = 0
imp = 1
for i in range(n):
	d = a[i] - b[i]
	if d == -1:
		unfav += 1
	elif d == 1:
		fav += 1
		imp = 0
if imp == 0:
	if (unfav + 1) % fav == 0:
		print((unfav + 1) // fav)
	elif (unfav + 1) % fav > 0:
		print((unfav + 1) // fav + 1)
else:
	print('-1')


import math, collections, sys
input = sys.stdin.readline
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
(countr, countb) = (0, 0)
for i in range(n):
	if r[i] and (not b[i]):
		countr += 1
	elif not r[i] and b[i]:
		countb += 1
if countr == 0:
	print(-1)
	return
print(countb // countr + 1)


from math import ceil
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
c1 = c2 = 0
for i in range(n):
	if l1[i] != l2[i]:
		c1 += l1[i]
		c2 += l2[i]
if c1 == 0:
	print(-1)
elif c1 > c2:
	print(1)
elif c2 % c1 == 0:
	print(c2 // c1 + 1)
else:
	print(ceil(c2 / c1))


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
pen = 0
for i in range(n):
	if a[i] == b[i]:
		pass
	elif a[i] == 1 and b[i] == 0:
		cnt += 1
	elif a[i] == 0 and b[i] == 1:
		pen += 1
ans = 1
if pen < cnt:
	print(1)
elif cnt == 0:
	print(-1)
else:
	pen -= cnt
	pen += 1
	rem = 0
	if pen % cnt == 0:
		rem = 0
	else:
		rem = 1
	print(math.floor(pen / cnt) + rem + 1)


import math
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
try:
	c1 = l1.count(1)
except:
	c1 = 0
try:
	c2 = l2.count(1)
except:
	c2 = 0
c = 0
for i in range(n):
	x = l1[i] ^ l2[i]
	if x == 0 and l1[i] == 1:
		c = c + 1
c1 = c1 - c
c2 = c2 - c
if c1 == 0:
	print(-1)
else:
	v = math.ceil(c2 / c1)
	if c2 % c1 == 0:
		v = v + 1
	print(v)


a = int(input())
z = list(map(int, input().split()))
r = list(map(int, input().split()))
com = 0
one = 0
two = 0
for i in range(len(z)):
	if z[i] == 1 and r[i] == 0:
		one = one + 1
	elif z[i] == 0 and r[i] == 1:
		two = two + 1
if one == 0:
	print(-1)
else:
	print(two // one + 1)


import sys
import math
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
n = int(input())
a = read()
b = read()
aa = 0
bb = 0
c = 0
for i in range(n):
	if a[i] == b[i] == 1:
		c += 1
	elif a[i] == 1:
		aa += 1
	elif b[i] == 1:
		bb += 1
if c == n or (aa == 0 and bb == 0):
	print('-1')
elif aa == 0 and bb > 0:
	print('-1')
else:
	ans = math.ceil(bb / aa)
	if ans == bb // aa:
		ans += 1
	print(ans)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aa = 0
bb = 0
if a == b:
	print(-1)
else:
	for i in range(n):
		if a[i] == 1 and a[i] != b[i]:
			aa += 1
		if b[i] == 1 and b[i] != a[i]:
			bb += 1
	ans = 1
if aa > bb:
	print(1)
elif aa == 0 and bb > 0:
	print(-1)
else:
	for i in range(1, 101):
		if i * aa > bb:
			print(i)
			break


from sys import stdin
inp = lambda : stdin.readline().strip()
n = int(inp())
a = [int(x) for x in inp().split()]
b = [int(x) for x in inp().split()]
flag = False
countA = 0
countB = 0
for (i, j) in zip(a, b):
	if i == 1 and j == 0:
		flag = True
		countA += 1
	elif j == 1 and i == 0:
		countB += 1
if flag:
	print(countB // countA + 1)
else:
	print(-1)


count = sum1 = sum2 = 0
count1 = 0
count2 = 0
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
	if a[i] > b[i]:
		count += 1
	elif a[i] < b[i]:
		count1 += 1
	else:
		count2 += 1
if count == 0 and count1 == 0:
	print('-1')
elif count != 0:
	final = count1 / count + 1
	print(int(final))
else:
	print('-1')


from math import ceil
n = int(input())
R = list(map(int, input().split()))
B = list(map(int, input().split()))
countR = 0
countB = 0
for (r, b) in zip(R, B):
	if r > b:
		countR += 1
	if r < b:
		countB += 1
if countR == 0:
	print(-1)
else:
	print(ceil(float(countB + 1) / countR))


for _ in range(1):
	from math import ceil
	n = int(input())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if a == b:
		print(-1)
		continue
	if sum(a) > sum(b):
		print(1)
	else:
		cou = cou2 = 0
		for i in range(n):
			if a[i] > b[i]:
				cou += 1
			if a[i] == b[i] == 1:
				cou2 += 1
		if cou == 0:
			print(-1)
		else:
			print(ceil((sum(b) - cou2 + 1) / cou))


n = int(input())
robo = list(map(int, input().split()))
bionic = list(map(int, input().split()))
only_bionic = sum((1 if b == 1 and robo[i] == 0 else 0 for (i, b) in enumerate(bionic)))
only_robo = sum((1 if r == 1 and bionic[i] == 0 else 0 for (i, r) in enumerate(robo)))
if only_robo == 0:
	print(-1)
	return
cost = only_bionic // only_robo + 1
print(cost)


import os
import io
from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce
from collections import deque
import threading

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
n = iinput()
a = rlinput()
b = rlinput()
oz = 0
zo = 0
for i in range(n):
	if a[i] == 0 and b[i] == 1:
		zo += 1
	if a[i] == 1 and b[i] == 0:
		oz += 1
if oz > zo:
	print(1)
elif oz == 0:
	print(-1)
else:
	print(zo // oz + 1)


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count1 = 0
count2 = 0
count3 = 0
for i in range(0, n):
	if A[i] == B[i]:
		count1 += 1
	elif A[i] < B[i]:
		count2 += 1
	else:
		count3 += 1
if count1 == n:
	print(-1)
elif count3 > 0:
	print(count2 // count3 + 1)
else:
	print(-1)


import math
n = int(input())
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
c = 0
d = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		c = c + 1
	if a[i] == 0 and b[i] == 1:
		d = d + 1
if d == 0 and c > 0:
	print(1)
elif d == 0 and c == 0:
	print(-1)
elif c == 0:
	print(-1)
else:
	print(d // c + 1)


import math
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
(cnt1, cnt2) = (0, 0)
for i in range(n):
	if a1[i] == 1 and a2[i] == 0:
		cnt1 += 1
	if a1[i] == 0 and a2[i] == 1:
		cnt2 += 1
if cnt1 == 0:
	print(-1)
else:
	print(math.ceil((cnt2 + 1) / cnt1))


problems = int(input())
robo = list(input().split())
bionic = list(input().split())
p_robo = 0
p_bionic = 0
for i in range(problems):
	if robo[i] != bionic[i]:
		if robo[i] == '1':
			p_robo += 1
		else:
			p_bionic += 1
if p_robo == 0:
	print('-1')
else:
	print(p_bionic // p_robo + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
solvea = 0
solveb = 0
if sum(a) == 0 or a == b:
	print(-1)
	exit()
else:
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			solvea += 1
		elif a[i] == 0 and b[i] == 1:
			solveb += 1
if solvea == 0:
	print(-1)
	exit()
print(int(solveb / solvea + 1))


from math import ceil
n = int(input().strip())
arr1 = list(map(int, input().strip().split()))
arr2 = list(map(int, input().strip().split()))
for i in range(n):
	arr1[i] -= arr2[i]
wins = arr1.count(1)
looses = arr1.count(-1)
if wins == 0:
	print(-1)
elif looses == 0:
	print(1)
else:
	print(ceil((looses + 1) / wins))


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

def test():
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(c1, c2) = (0, 0)
	for i in range(n):
		if r[i] - b[i] > 0:
			c1 += 1
		elif r[i] - b[i] < 0:
			c2 += 1
	if c1 == 0:
		return -1
	else:
		return int(c2 / c1 + 1)
print(test())


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s1 = 0
s2 = 0
for i in range(n):
	if a[i] == 0 and b[i] == 1:
		s2 += 1
	elif a[i] == 1 and b[i] == 0:
		s1 += 1
if s1 == 0:
	print(-1)
elif s1 > s2:
	print(1)
else:
	print(s2 // s1 + 1)


n = int(input())
A = {i for (i, x) in enumerate(map(int, input().split())) if x == 1}
B = {i for (i, x) in enumerate(map(int, input().split())) if x == 1}
P = A - B
Q = B - A
if P:
	if len(P) > len(Q):
		print(1)
	else:
		print(2 + (len(Q) - len(P)) // len(P))
else:
	print(-1)


import sys
P = int(sys.stdin.readline())
r1 = list(map(int, sys.stdin.readline().split()))
r2 = list(map(int, sys.stdin.readline().split()))
v1 = 0
v2 = 0
for i in range(P):
	if r1[i] and (not r2[i]):
		v1 += 1
	elif r2[i] and (not r1[i]):
		v2 += 1
if v1 == 0:
	print(-1)
else:
	print(v2 // v1 + 1)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rc = 0
bc = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		rc += 1
	if b[i] == 1 and r[i] == 0:
		bc += 1
if rc == 0:
	print(-1)
else:
	print(math.ceil((bc + 1) / rc))


import math
import sys
input = sys.stdin.readline
t = int(input())
robo = [int(i) for i in input().split()]
bio = [int(i) for i in input().split()]
(sum1, sum2) = (sum(robo), sum(bio))
extra = []
for i in range(t):
	if robo[i] == 1 and bio[i] == 1:
		sum1 -= 1
		sum2 -= 1
if sum1 == 0:
	x = -1
elif sum1 < sum2:
	x = sum2 // sum1 + 1
elif sum1 == sum2:
	x = 2
elif sum1 > sum2:
	x = 1
if sum1 == 0:
	x = -1
print(x)


from sys import stdin
n = int(stdin.readline())
R = list(map(int, stdin.readline().split(' ')))
B = list(map(int, stdin.readline().split(' ')))
Bionic_win = 0
Robo_win = 0
for i in range(n):
	if R[i] == 0 and B[i] == 1:
		Bionic_win += 1
	elif R[i] == 1 and B[i] == 0:
		Robo_win += 1
if Robo_win == 0:
	print('-1')
else:
	p = int(Bionic_win / Robo_win)
	print(str(p + 1))


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
score = [0] * n
for i in range(n):
	if r[i] == b[i] and r[i] == 0:
		score[i] = 1
	elif r[i] == b[i] and r[i] == 1:
		score[i] = 1
	elif b[i] == 1 and r[i] == 0:
		score[i] = 1
	elif b[i] == 0 and r[i] == 1:
		score[i] = 'x'
score_r = 0
score_b = 0
for i in range(n):
	if score[i] != 'x':
		score_r += score[i] * r[i]
		score_b += score[i] * b[i]
xs = score.count('x')
if xs == 0:
	print(-1)
else:
	ans = (score_b - score_r) // xs
	ans += 1
	print(ans)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(cca, ccb) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		cca += 1
	if a[i] == 0 and b[i] == 1:
		ccb += 1
res = 0
if cca == 0:
	res = -1
else:
	res = (ccb + cca) // cca
print(res)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = 0
y = 0
if sum(a) > sum(b):
	print(1)
else:
	for i in range(n):
		if a[i] > b[i]:
			x += 1
		elif a[i] < b[i]:
			y += 1
	if x:
		print(1 + y // x)
	else:
		print(-1)


import math
t = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
num1 = 0
num2 = 0
for i in range(t):
	if l1[i] == 1 and l2[i] == 0:
		num1 += 1
	elif l1[i] == 0 and l2[i] == 1:
		num2 += 1
if num1 == 0:
	print(-1)
else:
	print(math.ceil((num2 + 1) / num1))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(excess, count) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		count += 1
	if a[i] == 0 and b[i] == 1:
		excess += 1
if excess == 0 and count != 0:
	print(1)
elif excess == 0 and count == 0:
	print(-1)
elif count > excess:
	print(1)
elif count == 0:
	print(-1)
else:
	print(excess // count + 1)


from math import ceil
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cu1 = cu2 = 0
p = 1
for (i, j) in zip(a, b):
	if i == 1 and j == 0:
		cu1 += 1
	if i == 0 and j == 1:
		cu2 += 1
try:
	r = ceil((cu2 + 1) / cu1)
	print(r)
except:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(ca, cb) = (0, 0)
for i in range(n):
	if a[i] > b[i]:
		ca += 1
	elif a[i] < b[i]:
		cb += 1
if ca == 0:
	print(-1)
elif (cb + 1) % ca == 0:
	print((cb + 1) // ca)
else:
	print((cb + 1) // ca + 1)


import math
num_problems = int(input())
RCI = [int(i) for i in input().split(' ')]
BSI = [int(i) for i in input().split(' ')]
lost_points = 1
winning_problems = 0
for i in range(num_problems):
	if RCI[i] < BSI[i]:
		lost_points += 1
	elif RCI[i] > BSI[i]:
		winning_problems += 1
if winning_problems == 0:
	print('-1')
else:
	max_points = math.ceil(lost_points / winning_problems)
	print(max_points)


t = 1
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(aa, bb) = (0, 0)
	for i in range(n):
		if a[i] == 1 and b[i] != 1:
			aa += 1
		elif b[i] == 1 and a[i] != 1:
			bb += 1
	if aa == 0:
		print(-1)
	else:
		print(bb // aa + 1)


from math import *
n = int(input())
r = input().split()
b = input().split()
x = 0
y = 0
a = 0
while a < n:
	if r[a] == '1' and b[a] == '0':
		y += 1
	elif r[a] == '0' and b[a] == '1':
		x += 1
	a += 1
if y == 0:
	print(-1)
else:
	z = ceil((x + 1) / y)
	print(z)


n = int(input())
r = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
c = 0
for i in range(n):
	if r[i] == 1 and r[i] == b[i]:
		c += 1
(rc, bc) = (r.count(1) - c, b.count(1) - c)
if rc == 0:
	print(-1)
else:
	print((bc + 1) // rc if (bc + 1) % rc == 0 else (bc + 1) // rc + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(c1, c2) = (0, 0)
for i in range(n):
	if a[i] > b[i]:
		c1 += 1
	if a[i] < b[i]:
		c2 += 1
if c1 == 0 and c2 == 0 or c2 == n or c1 == 0:
	print('-1')
elif c1 == n:
	print('1')
else:
	x = c2 // c1 + 1
	print(x)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
rc = 0
bc = 0
for i in range(n):
	if r[i] == b[i]:
		ans += 1
	elif r[i] == 1:
		rc += 1
	elif b[i] == 1 and r[i] == 0:
		bc += 1
if ans == n or rc == 0:
	print('-1')
elif rc > bc:
	print(1)
else:
	print(int(bc / rc) + 1)


n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
reslst = []
for x in r:
	reslst.append(-1)
for i in range(len(r)):
	if r[i] == 0 and b[i] == 1:
		reslst[i] = 1
	elif r[i] == b[i]:
		reslst[i] = 1
onescount = 0
for i in reslst:
	if i == -1:
		onescount += 1
sum1 = sum(r)
sum2 = sum(b)
if onescount == 0:
	print(-1)
elif sum1 > sum2:
	print('1')
else:
	x = 2
	while 1:
		sum1 = sum1 + onescount * 1
		if sum1 > sum2:
			resval = x
			break
		x = x + 1
	print(resval)


q = lambda : map(int, input().split())
(n,) = q()
a = list(q())
b = list(q())
x = [1 for _ in range(n)]
if a == b or a.count(1) == 0 or b.count(1) == len(b):
	print(-1)
else:
	while sum([i * j for (i, j) in zip(a, x)]) <= sum([i * j for (i, j) in zip(b, x)]):
		for i in range(n):
			if a[i] == 1:
				x[i] += 1
			if sum([i * j for (i, j) in zip(a, x)]) > sum([i * j for (i, j) in zip(b, x)]):
				break
	print(max(x))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
a = lmp()
b = lmp()
(c1, c2) = (0, 0)
for i in range(n):
	if a[i] > b[i]:
		c1 += 1
	elif b[i] > a[i]:
		c2 += 1
if c1 == 0:
	print(-1)
else:
	print(ceil(c2 + 1, c1))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s1 = sum(a)
s2 = sum(b)
x = 0
if s1 == 0:
	print('-1')
elif s1 > s2:
	print('1')
else:
	for i in range(0, n):
		if a[i] == 1 and b[i] == 0:
			x = x + 1
		else:
			continue
	if x == 0:
		print('-1')
	else:
		for j in range(2, 101):
			s = s1 + (j - 1) * x
			if s > s2:
				print(j)
				break
			else:
				continue


n = int(input())
(a, b) = (0, 0)
l1 = list(map(str, input().split()))
l2 = list(map(str, input().split()))
for i in range(n):
	if l1[i] == '1' and l1[i] != l2[i]:
		a += 1
	if l2[i] == '1' and l2[i] != l1[i]:
		b += 1
print(b // a + 1 if a != 0 else -1)


import math

def cfr(l1, l2):
	a = 0
	b = 0
	for i in range(len(l1)):
		if l1[i] == 1 and l2[i] == 0:
			a = a + 1
		elif l1[i] == 0 and l2[i] == 1:
			b = b + 1
	if a == 0:
		print(-1)
		return
	if a > b:
		print(1)
		return
	b = b + 1
	if b % a == 0:
		print(int(b / a))
	else:
		print(int(b / a + 1))
	return
n = int(input())
r = input()
b = input()
l1 = list(map(int, r.split(' ')))
l2 = list(map(int, b.split(' ')))
cfr(l1, l2)


def robots(i, j, n):
	(count_both, count_r, count_b) = (0, 0, 0)
	for i in range(n):
		if r[i] == 1:
			count_r += 1
		if b[i] == 1:
			count_b += 1
		if r[i] == 1 and b[i] == 1:
			count_both += 1
	count_r -= count_both
	count_b -= count_both
	if count_r > count_b:
		return 1
	if count_r == 0:
		return -1
	else:
		return int(count_b / count_r) + 1
n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
print(robots(r, b, n))


n = int(input())
r = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]
a = list(zip(r, b))
l = []
for i in a:
	if i[0] != i[1]:
		l.append([i[0], i[1]])
m = sum([i[0] for i in l])
n = sum([i[1] for i in l])
if len(l) == 0 or m == 0:
	print('-1')
elif m > n:
	print('1')
elif m == n:
	print('2')
else:
	print(str(int(n // m + 1)))


n = int(input())
rob = [int(i) for i in input().split(' ')]
bio = [int(i) for i in input().split(' ')]
if rob == bio:
	print(-1)
elif sum(rob) > sum(bio):
	print(1)
else:
	rc = 0
	bc = 0
	for (i, elem) in enumerate(rob):
		if rob[i] < bio[i]:
			bc += 1
		elif rob[i] > bio[i]:
			rc += 1
	diff = bc - rc
	if rc == 0:
		print(-1)
	elif diff == 0:
		print(2)
	elif diff < 0:
		print(1)
	else:
		print(int(bc / rc) + 1)


n = int(input())
x = input()
r = x.split()
x = input()
b = x.split()
sr = 0
br = 0
for i in range(0, n):
	if r[i] == '1' and b[i] == '0':
		sr += 1
	elif r[i] == '0' and b[i] == '1':
		br += 1
if sr == 0:
	print(-1)
elif sr == 0 and br == 0:
	print(-1)
else:
	f = int(br // sr)
	print(f + 1)


n = int(input())
lst1 = list(map(int, input().strip().split(' ')))
lst2 = list(map(int, input().strip().split(' ')))
c = 0
l1 = 0
l2 = 0
for i in range(n):
	if lst1[i] == 1 and lst2[i] == 0:
		c += 1
	else:
		if lst1[i] == 1:
			l1 += 1
		if lst2[i] == 1:
			l2 += 1
if c == 0:
	print('-1')
elif l1 > l2:
	print('1')
else:
	d = (l2 - l1) // c + 1
	print(d)


import math
n = int(input())
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
alst = []
blst = []
suma = 0
sumb = 0
for i in range(n):
	if a[i] != b[i]:
		alst.append(a[i])
		blst.append(b[i])
for j in range(len(alst)):
	suma += alst[j]
	sumb += blst[j]
if suma == 0:
	print(-1)
elif suma > sumb:
	print(1)
else:
	print(math.ceil((sumb + 1) / suma))


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
count_r = 0
count_b = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		count_r += 1
	elif r[i] == 0 and b[i] == 1:
		count_b += 1
if r.count(1) > b.count(1):
	print(1)
elif b.count(1) == n or r.count(0) == n or r == b:
	print(-1)
else:
	k = max(math.ceil(count_b / count_r), count_b // count_r + 1)
	print(k)


from math import ceil
n = int(input())
mas1 = [i == '1' for i in input().split()]
mas2 = [i == '1' for i in input().split()]
ex1 = 0
ex2 = 0
for i in range(n):
	if mas1[i] and (not mas2[i]):
		ex1 += 1
	elif mas2[i] and (not mas1[i]):
		ex2 += 1
if ex1 == 0:
	print(-1)
else:
	v = ex2 / ex1
	if v == int(v):
		v = int(v) + 1
	else:
		v = ceil(v)
	print(v)


n = int(input())
c = 0
s = 0
r = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(0, n):
	if r[i] ^ b[i]:
		if r[i]:
			c += 1
		else:
			s += 1
if not c:
	print(-1)
else:
	print(s // c + 1)


from math import ceil
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
	y += a[i] - b[i]
	if a[i] > b[i]:
		x += 1
y = 1 - y
if y <= 0:
	print(1)
elif x == 0:
	print(-1)
else:
	print(ceil(y / x) + 1)


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
(c, d) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		c += 1
	elif a[i] == 0 and b[i] == 1:
		d += 1
if c == 0:
	print(-1)
else:
	print(d // c + 1)


n = int(input())
arr1 = [int(i) for i in input().split()]
arr2 = [int(i) for i in input().split()]
c = 0
summa = 0
for i in range(n):
	c += arr1[i] > arr2[i]
	summa += arr2[i] > arr1[i]
if c == 0:
	print(-1)
else:
	from math import floor
	print(floor(summa / c) + 1)


n = int(input())
lis1 = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
a = 0
b = 0
for i in range(n):
	if lis1[i] == 1 and lis2[i] == 0:
		a += 1
	elif lis1[i] == 0 and lis2[i] == 1:
		b += 1
if a == 0:
	print(-1)
elif (b + 1) / a == (b + 1) // a:
	print((b + 1) // a)
else:
	print((b + 1) // a + 1)


N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(ac, bc) = (0, 0)
result = 0
for i in range(N):
	if a[i] == 1 and b[i] == 0:
		ac += 1
	elif a[i] == 0 and b[i] == 1:
		bc += 1
if ac == 0:
	print(-1)
else:
	while ac * result <= bc:
		result += 1
	print(result)


def go():
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(ap, bp) = (0, 0)
	for (aa, bb) in zip(a, b):
		if aa and (not bb):
			ap += 1
		elif bb and (not aa):
			bp += 1
	if ap == 0:
		return -1
	return bp // ap + 1
print(go())


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
req = 0
chances = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		req += 1
	if r[i] == 1 and b[i] == 0:
		chances += 1
if chances != 0:
	if req == 0:
		print(1)
	else:
		print(req // chances + 1)
else:
	print(-1)


import math
questions = int(input())
(us, them) = (input().split(), input().split())
(only_us, only_them) = (0, 0)
for i in range(len(us)):
	if them[i] == '1' and us[i] == '0':
		only_them += 1
	elif us[i] == '1' and them[i] == '0':
		only_us += 1
if only_us == 0:
	print(-1)
else:
	print(int(math.ceil((only_them + 1) / only_us)))


import math
numproblems = int(input())
robocode = list(map(int, input().split()))
bionic = list(map(int, input().split()))
rob1 = 0
bionic1 = 0
for j in range(numproblems):
	r1 = robocode[j]
	b1 = bionic[j]
	if r1 == 1 and b1 == 0:
		rob1 += 1
	elif r1 == 0 and b1 == 1:
		bionic1 += 1
if rob1 == 0 and bionic1 == 0:
	print(-1)
elif rob1 > bionic1:
	print(1)
elif rob1 == bionic1:
	print(2)
elif rob1 < bionic1:
	if rob1 == 0:
		print(-1)
	else:
		print(math.floor(bionic1 / rob1) + 1)


import sys
import math
import heapq
import collections
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')

def printspace(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer(' ')

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
n = inputnum()
r = inputlist()
b = inputlist()
R = 0
B = 0
good = True
for i in range(n):
	if r[i] != b[i]:
		good = False
		if r[i] == 1:
			R += 1
		else:
			B += 1
if good or R == 0:
	print(-1)
else:
	print(B // R + 1)


n = int(input())
l = list(map(str, input().split()))
l1 = list(map(str, input().split()))
a = ''.join(l)
b = ''.join(l1)
a1 = int(a, 2)
b1 = int(b, 2)
if a1 == b1:
	print(-1)
	exit()
q = str(bin(a1 & b1))
w = a.count('1') - q.count('1')
ans = 0
if w != 0:
	ans = (b.count('1') - q.count('1')) // (a.count('1') - q.count('1')) + 1
else:
	print(-1)
	exit()
if ans > 0:
	print(ans)
elif ans == 0:
	print(1)
else:
	print(-1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
count1 = 0
count2 = 0
count3 = 0
for i in range(n):
	if l1[i] == 1 and l2[i] == 0:
		count1 += 1
	elif l2[i] == 1:
		count2 += 1
		if l1[i] == 1:
			count3 += 1
if count1 == 0:
	print('-1')
else:
	ans = (count2 - count3) // count1 + 1
	print(ans)


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
(count1, count2) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		count1 += 1
	if a[i] == 0 and b[i] == 1:
		count2 += 1
print(-1 if count1 < 1 else count2 // count1 + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c1 = 0
c2 = 0
for i in range(n):
	if a[i] != b[i]:
		if a[i] == 1:
			c1 += 1
		else:
			c2 += 1
if c1 == 0:
	print(-1)
else:
	print(c2 // c1 + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))

def func(n, r, b):
	lst = []
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			lst.append(i)
	if sum(r) > sum(b):
		res = max(r)
	elif len(lst) > 0:
		while sum(r) <= sum(b):
			for j in lst:
				r[j] += 1
				if sum(r) > sum(b):
					res = max(r)
					break
	else:
		res = -1
	return res
print(func(n, r, b))


t = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
c = d = 0
for i in range(t):
	c += int(r[i] == 0 and b[i] == 1)
	d += int(r[i] == 1 and b[i] == 0)
if d == 0:
	print(-1)
else:
	print(c // d + 1)


t = int(input())
robo = [int(i) for i in input().split()]
bionic = [int(i) for i in input().split()]
robowin = 0
bionicwin = 0
for i in range(t):
	if robo[i] > bionic[i]:
		robowin += 1
	elif robo[i] < bionic[i]:
		bionicwin += 1
if robowin == 0:
	print(-1)
else:
	print(bionicwin // robowin + 1)


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
under = 0
over = 0
p = 0
for i in range(n):
	if A[i] == 0 and B[i] == 1:
		under += 1
	elif A[i] == 1 and B[i] == 0:
		over += 1
if over == 0:
	print(-1)
elif under == over:
	print(2)
elif under < over:
	print(1)
elif under > over:
	mp = 0
	if (under + 1) % over == 0:
		mp = (under + 1) // over
	else:
		mp = (under + 1) // over + 1
	print(mp)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
l = [0] * n
x = 0
y = 0
for i in range(n):
	if r[i] - b[i] == 1:
		x += 1
	elif r[i] - b[i] == -1:
		y += 1
if x == 0:
	print(-1)
else:
	print(y // x + min(y % x + 1, 1))


(N, f, s) = (int(input()), 0, 0)
for (i, j) in zip(input(), input()):
	if i == '1' and i != j:
		f += 1
	if j == '1' and i != j:
		s += 1
print(s // f + 1 if f != 0 else -1)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	diff = 0
	split = 0
	for i in range(n):
		if a[i] == 0 and b[i] == 1:
			diff += 1
		if a[i] == 1 and b[i] == 0:
			split += 1
	if diff == 0:
		if split:
			print(1)
		else:
			print(-1)
	elif split:
		print((diff + 1) // split + ((diff + 1) % split > 0))
	else:
		print(-1)
main()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
	if a[i] == 1 and b[i] == 1:
		ans += 1
		a[i] = 0
		b[i] = 0
sa = sum(a)
sb = sum(b)
if sa == 0 and sb == 0 or (sa == 0 and sb != 0):
	print(-1)
elif sa > sb:
	print(1)
else:
	ans = sb // sa + 1
	print(ans)


i = lambda : input().split()
i()
(a, b) = (i(), i())
c = d = 0
for (i, x) in enumerate(a):
	c += x > b[i]
	d += b[i] > x
print([[1 - -(d + 1 - c) // max(1, c), 1][c > d], -1][c < 1])


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(cta, ctb) = (0, 1)
for i in range(n):
	if a[i] > b[i]:
		cta += 1
	elif b[i] > a[i]:
		ctb += 1
if cta == 0:
	print(-1)
else:
	print(math.ceil(ctb / cta))


n = int(input())
l = list(map(int, input().split()))
g = list(map(int, input().split()))
a = 0
b = 0
for i in range(n):
	if l[i] == 1 and g[i] == 0:
		a += 1
	if l[i] == 0 and g[i] == 1:
		b += 1
if a == 0:
	print(-1)
else:
	print(b // a + 1)


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
for tt in range(t):
	n = inp()
	a = inlt()
	b = inlt()
	(q, w) = (0, 0)
	for i in range(n):
		if a[i] > b[i]:
			q += 1
		elif b[i] > a[i]:
			w += 1
	if q == 0:
		print(-1)
	elif q > w:
		print(1)
	else:
		print(w // q + 1)


n = int(input())
l1 = input().split()
l2 = input().split()
c1 = c2 = 0
for i in range(n):
	if l1[i] == '1' and l2[i] == '0':
		c1 += 1
	if l2[i] == '1' and l1[i] == '0':
		c2 += 1
if c1 == 0:
	print(-1)
else:
	print(c2 // c1 + 1)


def answer(Rarr, Barr):
	AwinCount = 0
	BwinCount = 0
	AllSame = True
	for i in range(0, len(Rarr)):
		if Rarr[i] > Barr[i]:
			AwinCount += 1
			AllSame = False
		elif Rarr[i] < Barr[i]:
			BwinCount += 1
			AllSame = False
	if AllSame or AwinCount == 0:
		return -1
	if AwinCount > BwinCount:
		return 1
	if AwinCount == BwinCount:
		return 2
	totalPoint = BwinCount + 1
	if totalPoint % AwinCount == 0:
		return int(totalPoint // AwinCount)
	else:
		return int(totalPoint // AwinCount) + 1
_ = input()
Rarr = list(map(int, input().split()))
Barr = list(map(int, input().split()))
print(answer(Rarr, Barr))


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
e = 0
f = 0
for j in range(a):
	if b[j] != c[j]:
		if b[j] == 1:
			e = e + 1
		else:
			f = f + 1
if e == 0:
	print(-1)
else:
	print(f // e + 1)


n = int(input())
r = [int(r) for r in input().split()]
b = [int(r) for r in input().split()]
kr = 0
kb = 0
for i in range(len(b)):
	if r[i] == 0 and b[i] != 0:
		kr += 1
	if b[i] == 0 and r[i] != 0:
		kb += 1
if kb == 0:
	print(-1)
else:
	res = int(kr / kb)
	while res * kb <= kr:
		res += 1
	print(res)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(p, q) = (0, 0)
for i in range(n):
	if not (a[i] and b[i]):
		if a[i] == 1:
			p += 1
		elif b[i] == 1:
			q += 1
if p == 0:
	print(-1)
else:
	print(q // p + 1)


I = input
I()
r = p = 0
for (x, y) in zip(I(), I()):
	r += x > y
	p += x < y
print(r and p // r + 1 or -1)


import math
n = int(input())
rc = [int(i) for i in input().split()]
bs = [int(i) for i in input().split()]
c1 = 0
for i in bs:
	if i == 1:
		c1 += 1
com = 0
c2 = 0
for i in range(n):
	if rc[i] == bs[i] and rc[i] == 1:
		com += 1
	if rc[i] == 1 and bs[i] == 0:
		c2 += 1
excess = c1 - com + 1
if c2 == 0:
	print(-1)
else:
	print(math.ceil(excess / c2))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
d = 0
for i in range(n):
	if a[i] - b[i] == 1:
		c += 1
	if b[i] - a[i] == 1:
		d += 1
if c == 0:
	print(-1)
else:
	print(d // c + 1)


n = int(input())
a1 = list(map(int, input().split()))[:n]
a2 = list(map(int, input().split()))[:n]
both = list(zip(a1, a2))
win_rc = 0
rc = 0
bs = 0
for i in range(0, n):
	if a1[i] > a2[i]:
		rc = rc + 1
	elif a1[i] < a2[i]:
		bs = bs + 1
if rc == 0:
	print(-1)
else:
	print(bs // rc + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
if 1 not in r or 0 not in b:
	print(-1)
else:
	rc = r.count(1)
	bc = b.count(1)
	s = 0
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			s = s + 1
	if s == 0:
		print(-1)
	else:
		ans = (bc - rc + s) / s + 1
		print(int(ans))


import math
n = int(input())
r = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
nleada = 0
nleadb = 0
nleadab = 0
for (i, j) in zip(r, b):
	if i == 1:
		nleada += 1
	if j == 1:
		nleadb += 1
	if i == 1 and j == 1:
		nleadab += 1
if nleada > nleadb:
	print(1)
elif nleada == nleadb:
	if nleadab == nleada:
		print(-1)
	else:
		print(2)
elif nleadb == nleadab or nleada - nleadab == 0:
	print(-1)
else:
	val = nleadb - nleada
	dist = nleada - nleadab
	print(1 + math.ceil((val + 1) / dist))


import math
n = int(input())
r = [int(x) for x in input().strip().split()]
b = [int(x) for x in input().strip().split()]
zero1 = 0
one0 = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		zero1 += 1
	elif r[i] == 1 and b[i] == 0:
		one0 += 1
print(-1 if one0 == 0 else math.ceil((zero1 + 1) / one0))


n = int(input())
r = input().split()
b = input().split()
r_c = 0
b_c = 0
for i in range(n):
	if int(r[i]) == 1 and int(b[i]) == 0:
		r_c += 1
	elif int(r[i]) == 0 and int(b[i]) == 1:
		b_c += 1
if r_c == 0:
	print(-1)
else:
	print(int(b_c / r_c) + 1)


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def main():
	n = int(input())
	ar = inpt()
	br = inpt()
	(a, b) = (0, 0)
	for i in range(n):
		if ar[i] == 0 and br[i] == 1:
			b += 1
		if br[i] == 0 and ar[i] == 1:
			a += 1
	if a == 0:
		print(-1)
	else:
		print(b // a + 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
A = int(input())
B = list(map(int, input().split()))
C = list(map(int, input().split()))
if B == C:
	print('-1')
else:
	cont1 = 0
	cont2 = 0
	cont3 = 0
	for number in range(len(B)):
		if B[number] == 1 and C[number] == 0:
			cont1 += 1
		elif B[number] == 1 and C[number] == 1:
			cont2 += 1
		elif B[number] == 0 and C[number] == 0:
			pass
		else:
			cont3 += 1
	if cont1 == 0 and cont3 > 0:
		print('-1')
	elif cont3 % cont1 == 0:
		print(int(math.ceil(cont3 / cont1)) + 1)
	else:
		print(int(math.ceil(cont3 / cont1)))


n = int(input())
r = list(map(int, input().strip().split()))[:n]
b = list(map(int, input().strip().split()))[:n]
for i in range(0, n):
	if r[i] != b[i]:
		r.append(r[i])
		b.append(b[i])
del r[0:n]
del b[0:n]
if len(r) == 0 and len(b) == 0:
	print(-1)
else:
	k = b.count(1)
	c = r.count(1)
	if c == 0:
		print(-1)
	else:
		print(k // c + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
pa = 0
pb = 0
while i < n:
	if a[i] > b[i]:
		pa = pa + 1
	if a[i] < b[i]:
		pb = pb + 1
	i = i + 1
if pa == 0 and pb >= 0:
	print('-1')
else:
	x = pb + 1
	y = x / pa
	if y % 1 == 0:
		print(int(y))
	else:
		print(int(y) + 1)


import math
n = int(input())
comp1 = [int(i) for i in input().split()]
comp2 = [int(j) for j in input().split()]
score1 = 0
score2 = 0
s1 = 0
counter = 0
for (i, j) in zip(comp1, comp2):
	if i == 1 and j == 1:
		score1 += 1
		score2 += 1
	elif i == 0 and j == 1:
		score2 += 1
	elif i == 1 and j == 0:
		counter += 1
		s1 += 1
if score2 < score1 + s1:
	print(1)
	exit()
elif score1 == score2 == 0:
	print(-1)
	exit()
elif counter == 0:
	print(-1)
	exit()
else:
	MIN = math.floor((score2 - score1) / counter + 1)
	print(MIN)


import math
q = int(input())
robo = [int(i) for i in input().split()]
bionic = [int(i) for i in input().split()]
a = 0
b = 0
for x in range(q):
	if bionic[x] == 1 and robo[x] == 0:
		a += 1
	elif bionic[x] == 0 and robo[x] == 1:
		b += 1
if b == 0:
	print(-1)
else:
	print(math.floor(a / b + 1))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
g = 0
f = 1
for i in range(n):
	if a[i] > b[i]:
		g += 1
	elif b[i] > a[i]:
		f += 1
if g == 0:
	print(-1)
else:
	answer = (f + g - 1) // g
	print(answer)


n = int(input())
arr1 = [int(k) for k in input().split()]
arr2 = [int(k) for k in input().split()]
(count1, count2, count3, count4) = (0, 0, 0, 0)
for i in range(n):
	if arr1[i] == 1:
		count1 += 1
	if arr2[i] == 1:
		count2 += 1
if count1 > count2:
	print('1')
elif count1 == count2 == n:
	print('-1')
elif count1 == count2 == 0:
	print('-1')
else:
	for i in range(n):
		if arr1[i] == 0 and arr2[i] == 1:
			count3 += 1
		if arr1[i] == 1 and arr2[i] == 0:
			count4 += 1
	if count4 == 0 and count3 == 0 or count4 == 0:
		print('-1')
	else:
		print(count3 // count4 + 1)


from sys import stdin, stdout
read = lambda : map(int, stdin.readline().split())
from math import ceil
n = int(input())
(c1, c2) = (0, 0)
for i in range(n):
	r = list(read())
	b = list(read())
	for (i, j) in zip(r, b):
		c1 += i & ~j
		c2 += ~i & j
if c1 == 0:
	print(-1)
else:
	(d, m) = divmod(c2, c1)
	print(d + 1)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
(u, v) = (0, 0)
for i in range(len(r)):
	if r[i] == 1 and b[i] == 0:
		u += 1
	if b[i] == 1 and r[i] == 0:
		v += 1
if u == 0:
	print(-1)
elif u > v:
	print(1)
else:
	x = (v + u) // u
	print(x)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
tests = inp()
winners = inlt()
losers = inlt()
wintests = 0
losetests = 0
testcount = 0
while testcount < tests:
	if winners[testcount] > losers[testcount]:
		wintests += 1
	if losers[testcount] > winners[testcount]:
		losetests += 1
	testcount += 1
if wintests == 0:
	print(-1)
else:
	print(losetests // wintests + 1)


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():
	n = int(input())
	rr = [int(a) for a in input().split()]
	bb = [int(a) for a in input().split()]
	radv = 0
	badv = 0
	for (r, b) in zip(rr, bb):
		if r > b:
			radv += 1
		elif b > r:
			badv += 1
	if radv == 0:
		print(-1)
	else:
		print(badv // radv + 1)
main()


import math
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
X10 = X01 = 0
for i in range(n):
	if A[i] == 0 and B[i] == 1:
		X01 += 1
	if A[i] == 1 and B[i] == 0:
		X10 += 1
if X10 == 0:
	print(-1)
else:
	ans = math.ceil(X01 / X10)
	if X01 % X10 == 0:
		ans += 1
	print(ans)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
only_r = 0
only_b = 0
for i in range(n):
	if r[i] and (not b[i]):
		only_r += 1
	if b[i] and (not r[i]):
		only_b += 1
if only_r == 0:
	print(-1)
else:
	ans = only_b + 1
	while ans % only_r:
		ans += 1
	print(int(ans / only_r))


from math import ceil

def min_max_points(company1, company2):
	company1_adventage = 0
	company2_adventage = 0
	length = len(company1)
	for problem_nr in range(length):
		company1_adventage += company1[problem_nr] and (not company2[problem_nr])
		company2_adventage += not company1[problem_nr] and company2[problem_nr]
	if company1_adventage == 0:
		return -1
	return ceil((company2_adventage + 1) / company1_adventage)
input()
company1 = [int(x) for x in input().split()]
company2 = [int(x) for x in input().split()]
print(min_max_points(company1, company2))


n = int(input())
arr1 = [int(i) for i in input().split(' ')]
arr2 = [int(i) for i in input().split(' ')]
x = 0
y = 0
for i in range(n):
	if arr1[i] == 1 and arr2[i] == 0:
		x += 1
	elif arr1[i] == 0 and arr2[i] == 1:
		y += 1
if x == 0 or y // x + 1 < 1:
	print(-1)
else:
	print(y // x + 1)


import math
len_ = int(input())
List_RC = list(map(int, input().strip().split()))[0:len_]
List_BS = list(map(int, input().strip().split()))[0:len_]
same_count = 0
rc_count = 0
j = 0
for i in range(0, len_):
	if List_BS[i] == 1 and List_RC[i] == 1:
		same_count += 1
	elif List_RC[i] == 1 and List_BS[i] == 0:
		rc_count += 1
if sum(List_RC) == 0:
	print(-1)
elif rc_count == 0:
	print(-1)
elif sum(List_RC) > sum(List_BS):
	print(1)
elif sum(List_RC) == sum(List_BS):
	print(2)
else:
	extra = sum(List_BS) - same_count
	if extra % rc_count == 0:
		Res = extra / rc_count + 1
	else:
		Res = math.ceil(extra / rc_count)
	print(int(Res))


i = int(input())
win = [int(num) for num in input().split()]
los = [int(num) for num in input().split()]
wo = 0
lo = 0
for j in range(0, i):
	if win[j] != los[j]:
		if win[j] > los[j]:
			wo += 1
		elif win[j] < los[j]:
			lo += 1
if win == los or wo == 0:
	print(-1)
else:
	print(lo // wo + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
	print(-1)
	exit(0)
o1 = a.count(1)
o2 = b.count(1)
if o1 > o2:
	print(1)
	exit(0)
o = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		o += 1
if o == 0:
	print(-1)
	exit(0)
print((o2 - o1 + o) // o + 1)


n = int(input())
r = list(input().split())
b = list(input().split())
r_total = r.count('1')
b_total = b.count('1')
c = 0
for i in range(n):
	if r[i] == '1' and b[i] == '0':
		c += 1
if c:
	if r_total <= b_total:
		print((b_total - r_total + 1) // c + ((b_total - r_total + 1) % c > 0) + 1)
	else:
		print(1)
else:
	print(-1)


n = int(input())
rc = [int(x) for x in input().split()]
bi = [int(x) for x in input().split()]
rp = 0
bp = 0
for i in range(n):
	if rc[i] == 1 and bi[i] == 0:
		rp += 1
	elif rc[i] == 0 and bi[i] == 1:
		bp += 1
if rp == 0:
	print(-1)
elif rp > bp:
	print(1)
elif rp == bp:
	print(2)
else:
	print(bp // rp + 1)


t = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
k = 0
p = 0
for i in range(t):
	if a[i] == 0 and b[i] == 1:
		k += 1
	if a[i] == 1 and b[i] == 0:
		p += 1
if k == 0 and p == 0:
	print(-1)
elif p == 0:
	print(-1)
else:
	print(int(k // p) + 1)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
a = 0
f = 0
c = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		a = a + 1
	if r[i] == 1 and b[i] == 0:
		f = 1
		c = c + 1
if f == 0:
	print(-1)
elif c > a:
	print(1)
else:
	print(math.ceil((a + 1) / c))


n = int(input())
robo = list(map(int, input().split()))
bionic = list(map(int, input().split()))
if robo.count(1) > bionic.count(1):
	print(1)
elif robo.count(1) == bionic.count(1):
	if robo == bionic:
		print(-1)
	else:
		print(2)
else:
	i0 = -1
	sum = 0
	while i0 < len(robo) - 1:
		i0 += 1
		if robo[i0] == 1:
			if bionic[i0] == 1:
				sum += 1
	if sum == robo.count(1):
		print(-1)
	elif sum == 0:
		print(bionic.count(1) // robo.count(1) + 1)
	else:
		print((bionic.count(1) - sum) // (robo.count(1) - sum) + 1)


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
(p, q, r) = (0, 0, 0)
for i in range(a):
	if b[i] == 1 and c[i] == 0:
		p += 1
		r += 1
	elif b[i] == 0 and c[i] == 1:
		q += 1
if p > q:
	print(1)
elif r == 0:
	print(-1)
else:
	z = q - p + 1
	n = z // r
	if n * r == z:
		print(n + 1)
	else:
		print(n + 2)


import math

def calc(a, b):
	(a_s, b_s) = (0, 0)
	for i in range(len(a)):
		if a[i] == b[i]:
			continue
		a_s += a[i]
		b_s += b[i]
	if b_s > 0 and a_s == 0 or (b_s == 0 and a_s == 0):
		return -1
	if a_s > b_s:
		return 1
	if a_s == b_s:
		return 2
	return math.ceil((b_s + 1.0) / a_s)
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(calc(a, b))


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rz = rr = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		rr += 1
	elif r[i] == 1 and b[i] == 0:
		rz += 1
if rz == 0:
	print(-1)
else:
	print(rr // rz + 1)


from math import *
n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
co = 0
co2 = 0
for i in range(n):
	if r[i] > b[i]:
		co += 1
	elif r[i] < b[i]:
		co2 += 1
if co == 0:
	print(-1)
elif co2 >= co:
	lb = 0
	ub = 10 ** 20
	while lb + 1 < ub:
		tx = (ub + lb) // 2
		dx = (ub - lb) // 2
		if tx * co > co2 + 1:
			ub -= dx
		else:
			lb += dx
	tx = (ub + lb) // 2
	for i in range(3):
		if tx * co <= co2:
			tx += 1
		elif (tx - 1) * co > co2:
			tx -= 1
	print(tx)
else:
	print(1)


n = int(input())
ar = list(map(int, input().split()))
br = list(map(int, input().split()))
k1 = 0
k2 = 0
for i in range(n):
	if ar[i] != br[i]:
		if ar[i] == 1:
			k1 += 1
		else:
			k2 += 1
if k1 == 0 and k2 == 0:
	print(-1)
elif k1 == 0:
	print(-1)
elif k1 <= k2:
	ans = k2 // k1 + 1
	print(ans)
else:
	print(1)


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
n = int(input())
r = list(map(int, input().split()))[:n]
b = list(map(int, input().split()))[:n]
(count1, count2) = (0, 0)
flag = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		count1 += 1
	if r[i] == 0 and b[i] == 1:
		count2 += 1
if count1 == 0:
	print(-1)
else:
	ans = math.ceil((count2 + 1) / count1)
	print(ans)


n = int(input())
r = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
(cnt1, cnt2) = (0, 0)
for i in range(n):
	if r[i] + b[i] == 1:
		cnt1 += r[i] == 1
		cnt2 += b[i] == 1
if cnt1 > cnt2:
	ans = 1
elif cnt1 == cnt2:
	if cnt1 == 0:
		ans = -1
	else:
		ans = 2
elif cnt1 != 0:
	ans = (cnt2 + 1) // cnt1
	if ans * cnt1 < cnt2 + 1:
		ans += 1
else:
	ans = -1
print(ans)


def solve(test_case):
	n = read(int)
	(ac, bc) = (0, 0)
	for (a, b) in zip(read([int]), read([int])):
		if a == b == 1:
			continue
		ac += a
		bc += b
	if ac == 0:
		print(-1)
	else:
		print(1 + bc // ac)
MOD = 10 ** 9 + 7

class Config:
	has_tests = False
	debug = False
	print_recursion = False
	prime_sieve = None
import math
from collections import defaultdict
from collections import namedtuple
from heapq import heapify, heappop, heappush, heappushpop, heapreplace

def trie():
	return defaultdict(trie)

def _():
	print(heapify, heappop, heappush, heappushpop, heapreplace, namedtuple, math)

class NumberTheory:

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if Config.prime_sieve is not None and n <= Config.prime_sieve:
			return spf[n] == n
		f = 3
		while f * f <= n:
			if n % f == 0:
				return False
		return True

	@staticmethod
	def prime_factorize(n):
		pass

	@staticmethod
	def count_factors(n):
		pass

	@staticmethod
	def sum_of_factors(n):
		pass

	@staticmethod
	def ncr(n, r):
		pass

	@staticmethod
	def mod_ncr(n, r, m):
		pass

	@staticmethod
	def pow(n, p):
		ans = 1
		while p > 0:
			if p % 2 == 1:
				ans *= n
			n *= n
			p //= 2
		return ans

	@staticmethod
	def mod_pow(n, p, m):
		ans = 1
		while p > 0:
			if p % 2 == 1:
				ans = ans * n % m
			n = n * n % m
			p //= 2
		return ans

def read(typ, times=None, delimiter=None):
	if times is not None:
		return [read(typ, times=None, delimiter=delimiter) for _ in range(times)]
	if isinstance(typ, list):
		return list(map(typ[0], input().strip().split(delimiter)))
	return typ(input().strip())

class BBST:
	pass

class SegmentTree:
	pass

class DisjointSet:

	def __init__(self):
		self._parents = {}
		self._rank = defaultdict(lambda : 1)

	def find(self, x):
		parent = self._parents.get(x, x)
		while parent != x:
			grand = self._parents.get(parent, parent)
			(x, parent, self._parents[x]) = (parent, grand, grand)
		return parent

	def rank(self, x):
		return self._rank[self.find(x)]

	def merge(self, x, y):
		(x, y) = (self.find(x), self.find(y))
		if self.rank(x) < self.rank(y):
			(x, y) = (y, x)
		self._parents[y] = x
		self._rank[x] += self._rank[y]
		del self._rank[y]

def sieve(n):
	global spf
	spf = [i for i in range(n + 1)]
	(spf[0], spf[1]) = (-1, -1)
	i = 2
	while i * i <= n:
		if spf[i] == i:
			for j in range(i * i, n + 1, i):
				spf[j] = i
		i += 1

def main():
	if Config.prime_sieve is not None:
		sieve(Config.prime_sieve)
	if Config.has_tests:
		for t in range(read(int)):
			solve(t)
	else:
		solve(None)
spf = []
main()


n = int(input())
rc = list(map(int, input().split()))
bs = list(map(int, input().split()))
p = []
both = 0
onlyBs = 0
onlyRc = 0
for i in range(len(rc)):
	if rc[i] == 1 and bs[i] == 1 or (rc[i] == 0 and bs[i] == 0):
		both += 1
	elif rc[i] == 0 and bs[i] == 1:
		onlyBs += 1
	else:
		onlyRc += 1
bsScore = both + onlyBs
RcScore = both + onlyRc
if onlyRc != 0:
	k = int(onlyBs / onlyRc) + 1
else:
	k = 0
if k == 0:
	print(-1)
else:
	print(k)


from math import ceil
n = int(input())
arr1 = [int(j) for j in input().split()]
arr2 = [int(j) for j in input().split()]
ans = [0] * n
for i in range(n):
	if arr1[i] == arr2[i]:
		ans[i] = 1
count1 = 0
for i in range(n):
	if arr1[i] == 0 and arr2[i] == 1:
		count1 += 1
		ans[i] = 1
count2 = 0
for i in range(n):
	if arr1[i] == 1 and arr2[i] == 0:
		count2 += 1
if count1 == 0 and count2 == 0:
	print(-1)
elif count2 == 0:
	print(-1)
elif count1 % count2 == 0:
	print(count1 // count2 + 1)
else:
	print(ceil(count1 / count2))


import math
t = int(input())
a = list(map(int, input().split()))
l = list(map(int, input().split()))
c = 0
d = 0
for i in range(t):
	if l[i] - a[i] == 1:
		c += 1
	elif a[i] - l[i] == 1:
		d += 1
if d == 0:
	print(-1)
else:
	s = math.ceil(c / d)
	if math.floor(c / d) == s:
		s += 1
	print(s)


import math
n = int(input())
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
(ca, cb) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		ca += 1
	if a[i] == 0 and b[i] == 1:
		cb += 1
if ca == 0:
	print('-1')
elif cb < ca:
	print('1')
else:
	print(int(math.ceil((cb + 1) / ca)))


import time
import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string, heapq as h
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInt():
	return int(input())

def getStrs():
	return input().split()

def getInts():
	return list(map(int, input().split()))

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	R = getInts()
	B = getInts()
	x = y = 0
	for i in range(N):
		if R[i] and (not B[i]):
			x += 1
		if B[i] and (not R[i]):
			y += 1
	if not x:
		return -1
	return y // x + 1
print(solve())


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(pos, neg) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		pos += 1
	elif a[i] == 0 and b[i] == 1:
		neg += 1
if pos == 0:
	print(-1)
else:
	ret = neg // pos
	if ret * pos <= neg:
		ret += 1
	print(ret)


import math
n = int(input())
(ans, res) = (0, 0)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(l, m) = (a.count(1), b.count(1))
if l == 0 or (l == n and m == n):
	print('-1')
else:
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			ans += 1
	if ans == 0:
		print('-1')
	else:
		print(int(math.ceil((m + 1 - (l - ans)) / ans)))


n = int(input())
ls = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
a = ls.count(1)
b = l.count(1)
d1 = dict()
d2 = dict()
c = 0
for i in range(n):
	if ls[i] == 1:
		d1[i] = 1
	if l[i] == 1:
		d2[i] = 1
for i in range(n):
	if i in d1 and i in d2:
		c += 1
res = a - c
if res == 0:
	print(-1)
else:
	ans = (b - c) // res + 1
	print(ans)


from math import ceil

def contest(n, m, k):
	if n > 100 or n < 0:
		return 'Incorrect input'
	else:
		k = k.split()
		m = m.split()
		k = [int(k[i]) for i in range(len(k))]
		m = [int(m[i]) for i in range(len(m))]
		if len(m) != n or len(k) != n:
			return 'Incorrect input'
	count1 = 0
	count = 0
	count2 = 0
	for i in range(n):
		if m[i] == k[i]:
			count += 1
		if m[i] == 1 and k[i] == 0:
			count1 += 1
		if k[i] == 1 and m[i] == 0:
			count2 += 1
	if count == n or count1 == 0:
		return -1
	if count2 % count1 == 0:
		return count2 // count1 + 1
	return count2 // count1 + 1
print(contest(int(input().strip()), input().strip(), input().strip()))


input()
x = list(map(int, input().split()))
y = list(map(int, input().split()))
counter = 0
(sa, sb) = (sum(x), sum(y))
if sa <= sb:
	for i in range(len(x)):
		if x[i] == 1 and y[i] == 0:
			counter += 1
	if counter == 0:
		print(-1)
	else:
		print((sb - sa) // counter + 2)
else:
	print(1)


n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
not_solved = 0
solved = 0
for i in range(n):
	if arr1[i] < arr2[i]:
		not_solved += 1
	elif arr1[i] > arr2[i]:
		solved += 1
if not_solved == 0 and solved == 0:
	print(-1)
elif not_solved == 0:
	print(1)
elif solved == 0:
	print(-1)
else:
	print(not_solved // solved + 1)


import math
n = int(input())
arr = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
total1 = 0
total2 = 0
arr_count = 0
total1 = sum(arr)
total2 = sum(arr2)
if total2 == len(arr2):
	print(-1)
	exit()
for i in range(len(arr)):
	if arr[i] == 1 and arr[i] == arr2[i]:
		arr_count += 1
if arr_count == total1:
	print(-1)
	exit()
total1 -= arr_count
total2 -= arr_count
val = math.ceil((total2 + 1) / total1)
print(val)


import math
n = int(input())
r = [int(xr) for xr in input().split()]
b = [int(xr) for xr in input().split()]
lo = 0
hi = 0
if r == b:
	print(-1)
	exit()
if sum(r) > sum(b):
	print(1)
	exit()
for x in range(n):
	if b[x] == 0 and r[x] == 1:
		hi += 1
	elif r[x] == 0 and b[x] == 1:
		lo += 1
if hi == 0:
	print(-1)
	exit()
print(math.ceil((lo + 1) / hi))


import math
import os
import random
import re
import sys

def get_max_len(a, b):
	if len(a) != len(b):
		return -1
	wins = 0
	loses = 0
	for i in range(len(a)):
		if a[i] == 1 and b[i] == 0:
			wins += 1
		elif a[i] == 0 and b[i] == 1:
			loses += 1
	if wins != 0:
		p = loses // wins
		return p + 1
	else:
		return -1
t = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(str(get_max_len(a, b)))


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rp = 0
bp = 0
ans = 0
for i in range(n):
	if r[i] == b[i]:
		ans += 1
	elif b[i] == 1:
		bp += 1
	else:
		rp += 1
if rp != 0:
	if rp > bp:
		print(1)
	elif (bp + 1) // rp == (bp + 1) / rp:
		print((bp + 1) // rp)
	else:
		print((bp + 1) // rp + 1)
else:
	print(-1)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ac = 0
bc = 0
cc = 0
for i in range(len(a)):
	if a[i] == 1:
		if b[i] == 1:
			cc += 1
		else:
			ac += 1
	elif b[i] == 1:
		bc += 1
if ac == 0:
	print(-1)
elif bc % ac == 0:
	print(bc // ac + 1)
else:
	print(math.ceil(bc / ac))


x = input()
nums1 = input().strip().split()
nums2 = input().strip().split()
cnt1 = 0
cnt2 = 0
for i in range(int(x)):
	if nums1[i] == '1' and nums2[i] == '0':
		cnt1 += 1
	elif nums1[i] == '0' and nums2[i] == '1':
		cnt2 += 1
if cnt1 == 0:
	print(-1)
else:
	print(int(cnt2 / cnt1) + 1)


import operator
int(input())
l = list(filter(lambda a: a != 0, map(operator.sub, map(int, input().split()), map(int, input().split()))))
k = l.count(1)
n = len(l)
try:
	print(next((x for (x, val) in enumerate([g > 0 for g in ((x + 1) * k - n for x in range(1, n + 1))]) if val > 0)) + 1)
except StopIteration:
	print(-1)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_sum = 0
b_sum = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		a_sum += a[i]
	elif a[i] == 0 and b[i] == 1:
		b_sum += b[i]
if a_sum == 0:
	print(-1)
else:
	print(math.ceil((b_sum + 1) / a_sum))


import math
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ca = 0
cb = 0
u = 0
for i in a:
	if i == 1:
		ca += 1
for i in b:
	if i == 1:
		cb += 1
for i in range(n):
	if a[i] == 1 and b[i] == 1:
		u += 1
if ca == u and cb == u:
	print(-1)
elif ca == cb and ca != u:
	print(2)
elif ca > cb:
	print(1)
else:
	cb = cb - u
	ca = ca - u
	if ca <= 0:
		print(-1)
	else:
		print(math.floor(cb / ca) + 1)


def solution():
	from sys import stdout, stdin
	(_input, _print) = (stdin.readline, stdout.write)
	n = int(input())
	r = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	r_count = r.count(1)
	b_count = b.count(1)
	c_count = 0
	m_count = 0
	for i in range(n):
		if r[i] == b[i] and r[i] == 1:
			c_count += 1
		elif r[i] != b[i]:
			m_count += 1
	if r_count == b_count and m_count == 0:
		print(-1)
	elif r_count > b_count:
		if b_count - c_count > 0:
			print(1)
		else:
			print(1)
	elif abs(r_count - c_count) > 0:
		print(abs(b_count - c_count) // abs(r_count - c_count) + 1)
	else:
		print(-1)
solution()


import math
n = int(input())
ri = list(map(int, input().split()))
bi = list(map(int, input().split()))
r = b = 0
for i in range(n):
	if ri[i] == 1 and bi[i] == 0:
		r += 1
	elif ri[i] == 0 and bi[i] == 1:
		b += 1
if r == 0:
	print(-1)
elif r > b:
	print(1)
else:
	print(b // r + 1)


import sys
a = input()
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
count = 0
equal = 1
for i in range(0, len(arr)):
	if arr[i] == 1 and brr[i] == 0:
		count = count + 1
	if not arr[i] == brr[i]:
		equal = 2
if equal == 1 or count == 0:
	print(-1)
	sys.exit()
if sum(arr) > sum(brr):
	print(1)
else:
	print(int((sum(brr) - sum(arr)) / count + 2))


t = int(input())
robA = [int(x) for x in input().split()]
robB = [int(x) for x in input().split()]
count = 0
scoreA = 0
scoreB = 0
for i in range(t):
	if robA[i] == 1:
		scoreA += 1
	if robB[i] == 1:
		scoreB += 1
	if robA[i] == robB[i]:
		continue
	elif robA[i] == 1 and robB[i] == 0:
		count += 1
if count == 0:
	print(-1)
elif scoreB >= scoreA:
	for l in range(1000):
		if count * l + (scoreA - count) > scoreB:
			print(l)
			break
else:
	print(1)


n = int(input())
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
r1 = 0
r2 = 0
for i in range(n):
	if s1[i] > s2[i]:
		r1 += 1
	elif s2[i] > s1[i]:
		r2 += 1
if r1 == 0:
	print(-1)
else:
	print(r2 // r1 + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pa = 0
pb = 0
for i in range(n):
	if a[i] == b[i]:
		continue
	elif a[i] == 0:
		pb += 1
	else:
		pa += 1
if pa == 0:
	print('-1')
elif pa > pb:
	print('1')
else:
	print(pb // pa + 1)


n = int(input())
rli = list(map(int, input().split()))
bli = list(map(int, input().split()))
if rli == bli or max(rli) == 0:
	print('-1')
elif max(bli) == 0:
	print('1')
else:
	c1 = sum(rli)
	c2 = sum(bli)
	a = 0
	b = 0
	c = 0
	for i in range(n):
		if rli[i] == bli[i] and rli[i] == 1:
			a += 1
		elif rli[i] == 0 and bli[i] == 1:
			b += 1
		elif rli[i] == 1 and bli[i] == 0:
			c += 1
		else:
			pass
	try:
		print((c + b) // c)
	except:
		print('-1')


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A == B:
	print(-1)
else:
	count = count_1 = 0
	for (idx, val) in enumerate(A):
		if val == 1 and B[idx] == 0:
			count += 1
		elif B[idx] > val:
			count_1 += 1
	if count == 0:
		print(-1)
		exit()
	print(count_1 // count + 1 if count_1 >= count else 1)


from math import ceil
n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
p = [1] * n
f = 0
rs = sum(r)
bs = sum(b)
if rs > bs:
	print(1)
else:
	need = bs - rs + 1
	c = 0
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			c += 1
	if c == 0:
		print(-1)
	else:
		print(1 + ceil(need / c))


n = int(input())
rc = [int(i) for i in input().split()]
cntrc = 0
bs = [int(i) for i in input().split()]
cntbs = 0
for i in range(n):
	if rc[i] == 1 and bs[i] == 0:
		cntrc += 1
	elif rc[i] == 0 and bs[i] == 1:
		cntbs += 1
if cntrc == 0:
	print(-1)
elif cntbs == 0:
	print(1)
else:
	print(cntbs // cntrc + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
lose = win = draw = 0
for i in range(n):
	if r[i] < b[i]:
		lose += 1
	elif r[i] == b[i]:
		draw += 1
	else:
		win += 1
if win == 0:
	print(-1)
elif lose % win == 0:
	print(lose // win + 1)
else:
	print(lose // win + 1)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
cb = 0
for i in range(n):
	if a[i] != b[i]:
		if a[i] == 0:
			count += 1
		if b[i] == 0:
			cb += 1
if cb == 0:
	print(-1)
else:
	print(math.floor(count / cb) + 1)


input()
r = input().split()
b = input().split()
m = 0
d = 0
for (x, y) in zip(r, b):
	if x == y:
		continue
	m += +(y == '1')
	d += +(y == '0')
if d > 0:
	print(m // d + 1)
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ac = 0
bc = 0
for i in range(n):
	if a[i] > b[i]:
		ac += 1
	elif a[i] < b[i]:
		bc += 1
if ac == 0:
	print(-1)
elif ac > bc:
	print(1)
else:
	print(bc // ac + 1)


import math
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a_wins = 0
b_wins = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		a_wins += 1
	if a[i] == 0 and b[i] == 1:
		b_wins += 1
if a_wins == 0:
	print(-1)
else:
	print(b_wins // a_wins + 1)


import sys
import math
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
n = int(input())
a = I()
b = I()
f = True
done = False
ac = a.count(1)
bc = b.count(1)
both = 0
for i in range(n):
	if a[i] == 0 and b[i] == 1 or (a[i] == 0 and b[i] == 1):
		f = False
	if a[i] and b[i]:
		both += 1
if ac == both:
	print(-1)
else:
	print(math.ceil((bc - both + 1) / (ac - both)))


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
rr = [0] * a
ss = 0
dd = 0
for i in range(a):
	if c[i] == 1:
		dd += 1
		rr[i] = 1
	if b[i] == 1:
		ss += 1
if dd == a or ss == 0:
	print(-1)
else:
	tt = dd + 1
	for i in range(a):
		if rr[i] == 1 and b[i] == 1:
			tt -= 1
			ss -= 1
	if ss == 0:
		print(-1)
	else:
		print((tt + ss - 1) // ss)


import sys
input = sys.stdin.readline
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
	if p[i] and (not q[i]):
		x += 1
	elif q[i] and (not p[i]):
		y += 1
if x == 0:
	print(-1)
elif x > y:
	print(1)
else:
	print(y // x + 1)


n = int(input())
u = list(map(int, input().split()))
w = list(map(int, input().split()))
a = b = 0
for i in range(n):
	if u[i] == 1 and w[i] == 0:
		a += 1
	elif u[i] == 0 and w[i] == 1:
		b += 1
if b < a:
	print(1)
elif a == 0:
	print(-1)
else:
	cur = b - a + 1
	print((cur - 1) // a + 2)


n = int(input())
a = [int(a) for a in input().split()]
b = [int(b) for b in input().split()]
r = 0
c = list()
e = list()
while r < n:
	c.append(a[r] + b[r])
	e.append(a[r] - b[r])
	r = r + 1
if c.count(1) == 0 or (e.count(-1) != 0 and e.count(1) == 0):
	print(-1)
else:
	d = (b.count(1) - c.count(2) + 1) / (a.count(1) - c.count(2))
	if c.count(1) != 0 and (b.count(1) - c.count(2) + 1) % (a.count(1) - c.count(2)) != 0:
		print(int(d) + 1)
	else:
		print(int(d))


n = int(input())
R = list(map(int, input().split()))
B = list(map(int, input().split()))
P = 0
S = 0
for i in range(n):
	if R[i] == 1 and B[i] == 0:
		P += 1
		S += 1
	elif R[i] == 0 and B[i] == 1:
		S -= 1
if S > 0:
	print(1)
elif P == 0:
	print(-1)
else:
	print(1 + -(-(1 - S) // P))


import math
n = int(input())
r = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
r_score = r.count(1)
b_score = b.count(1)
count = 0
for i in range(n):
	if r[i] == 1 and b[i] != 1:
		count += 1
if r_score > b_score:
	ans = 1
elif count >= 1:
	r_score -= count
	ans = math.ceil((b_score - r_score + 1) / count)
else:
	ans = -1
print(ans)


import math
N = int(input())
robo = list(map(int, input().split()))
bio = list(map(int, input().split()))
bio_points = sum([1 for i in range(N) if bio[i] > robo[i]])
robo_probs = sum([1 for i in range(N) if bio[i] < robo[i]])
if robo_probs == 0:
	print(-1)
elif bio_points == 0:
	print(1)
elif bio_points % robo_probs == 0:
	print(int(bio_points / robo_probs) + 1)
else:
	print(math.ceil(bio_points / robo_probs))


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
c = 0
d = 0
for i in range(n):
	if A[i] != B[i] and A[i] == 1:
		c = c + 1
	elif A[i] != B[i] and B[i] == 1:
		d = d + 1
if c == 0:
	print(-1)
else:
	print(d // c + 1)


n = int(input())
a = []
b = []
a = list(map(int, input().split()))
b = list(map(int, input().split()))
numb_a_not_b = 0
numb_b_not_a = 0
numb_a_and_b = 0
numb_not = 0
for i in range(n):
	if a[i] == b[i]:
		if a[i] == 0:
			numb_not += 1
		else:
			numb_a_and_b += 1
	elif a[i] == 0:
		numb_b_not_a += 1
	else:
		numb_a_not_b += 1
if numb_not == n or numb_a_and_b == n:
	print(-1)
elif numb_b_not_a > numb_a_not_b and numb_a_not_b != 0:
	print(numb_b_not_a // numb_a_not_b + 1)
elif numb_a_not_b == 0:
	print(-1)
elif numb_a_not_b == numb_b_not_a:
	print(2)
else:
	print(1)


from math import ceil
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count1 = 0
count2 = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		count1 += 1
	elif a[i] == 0 and b[i] == 1:
		count2 += 1
if count1 == 0:
	print(-1)
elif count2 % count1 == 0:
	print(1 + count2 // count1)
else:
	print(ceil(count2 / count1))


n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
r_set = set()
b_set = set()
for i in range(n):
	if r[i]:
		r_set.add(i)
	if b[i]:
		b_set.add(i)
if not r_set - b_set:
	p_max = -1
else:
	b_score = len(b_set - r_set)
	r_more = len(r_set - b_set)
	p_max = b_score // r_more + 1
print(p_max)


(N, First, Second, Win1, Win2) = (int(input()), input(), input(), 0, 0)
for (i, j) in zip(First, Second):
	if i == '1' and i != j:
		Win1 += 1
	if j == '1' and i != j:
		Win2 += 1
print(Win2 // Win1 + 1 if Win1 != 0 else -1)


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if a == b:
	print(-1)
else:
	a_c = 0
	b_c = 0
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			a_c += 1
		elif a[i] == 0 and b[i] == 1:
			b_c += 1
	if a_c == 0:
		print(-1)
	else:
		ans = b_c // a_c
		ans += 1
		print(ans)


n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
w = sum((1 for i in range(n) if r[i] > b[i]))
l = sum((1 for i in range(n) if r[i] < b[i]))
if w == 0:
	print(-1)
elif l % w == 0:
	print(l // w + 1)
else:
	print(l // w + 1)


n = int(input(''))
r = input('').split(' ')
b = input('').split(' ')
x = 0
y = 0
z = 0
for k in range(0, n):
	if r[k] == '1' and b[k] == '0':
		x = x + 1
	elif b[k] == '1' and r[k] == '0':
		y = y + 1
	elif b[k] == '1' and r[k] == '1':
		x = x + 1
		y = y + 1
		z = z + 1
if x == y and x == n:
	print(-1)
elif x > y:
	print(1)
elif x < y and x - z != 0:
	print((y - z) // (x - z) + 1)
elif x - z == 0:
	print(-1)
elif x == y and z < x and (x < n):
	print(2)


n = int(input())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
num = 0
num1 = 0
for i in range(n):
	if a[i] == 1 and b[i] != 1:
		num += 1
	elif a[i] != 1 and b[i] == 1:
		num1 += 1
print(num and num1 // num + 1 or -1)


import math as m
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
f = 0
cnt = 0
if b.count(1) == n:
	print(-1)
elif r.count(1) > b.count(1):
	print(1)
else:
	k = b.count(1) - r.count(1)
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			cnt += 1
			f = 1
	if cnt > 0:
		print(1 + m.ceil((k + 1) / cnt))
	if f == 0:
		print(-1)


import sys

def solve(N, R, B):
	less = 0
	eq = 0
	more = 0
	for i in range(N):
		if R[i] < B[i]:
			less += 1
		elif R[i] > B[i]:
			more += 1
		else:
			eq += 1
	if more == 0:
		return -1
	(d, r) = divmod(less, more)
	if r == 0:
		return d + 1
	return d + 1

def __starting_point():
	(N,) = list(map(int, input().split()))
	R = [int(x) for x in input().split()]
	B = [int(x) for x in input().split()]
	ans = solve(N, R, B)
	print(ans)
__starting_point()


import sys
import math

def scan(input_type='int'):
	if input_type == 'int':
		return list(map(int, sys.stdin.readline().strip().split()))
	else:
		return list(map(str, sys.stdin.readline().strip()))

def solution():
	n = int(input())
	r = scan()
	b = scan()
	y = 0
	x = 0
	for i in range(n):
		if r[i] == b[i]:
			continue
		elif b[i] == 1:
			y += 1
		elif r[i] == 1:
			x += 1
	if x == 0:
		print(-1)
	else:
		print(math.ceil((y + 1) / x))
solution()


import math
n = int(input())
r = list(map(int, input().split()))
p = list(map(int, input().split()))
s = sum(r) - sum(p)
if s > 0:
	print(1)
else:
	s = sum(p) - sum(r)
	s += 1
	h = 0
	for i in range(0, n):
		if r[i] == 1 and p[i] == 0:
			h += 1
	if h > 0:
		print(math.ceil(s / h) + 1)
	else:
		print(-1)


numberProblems = int(input())
company1 = list(map(int, input().split()))
company2 = list(map(int, input().split()))
bothSolve = [0] * len(company1)
for i in range(len(company1)):
	if company1[i] and company2[i]:
		company1[i] = 0
		company2[i] = 0
		bothSolve[i] = 1
if max(company1) == 0:
	print('-1')
else:
	pointsRequired = sum(company2)
	sumCompany1 = sum(company1)
	n = 1
	while n * sumCompany1 <= pointsRequired:
		n += 1
	print(n)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if set(a) == {0} or set(b) == {1} or a == b:
	print(-1)
else:
	p = [1] * n
	asum = sum(a)
	bsum = sum(b)
	i = 0
	while asum <= bsum and i < n * n:
		if a[i % n] == 1 and b[i % n] == 0:
			asum += 1
			p[i % n] += 1
		i += 1
	print(max(p))


n = int(input())
(*a,) = map(int, input().split())
(*b,) = map(int, input().split())
x = y = 0
for i in range(n):
	if a[i] and (not b[i]):
		x += 1
	if b[i] and (not a[i]):
		y += 1
if x == 0:
	print(-1)
else:
	print((x + y) // x)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	input()
	aa = LI()
	bb = LI()
	x = y = 0
	for (a, b) in zip(aa, bb):
		if a > b:
			x += 1
		if a < b:
			y += 1
	if x == 0:
		print(-1)
	else:
		print((y + x) // x)
main()


n = int(input())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
a = 0
b = 0
flag = 0
for i in range(n):
	if arr[i] == 1 and brr[i] == 0:
		a += 1
	elif arr[i] == 0 and brr[i] == 1:
		b += 1
	else:
		flag += 1
if flag == n:
	print(-1)
elif a == 0 and b > 0:
	print(-1)
elif a == 0 and b == 0:
	print(-1)
else:
	print(b // a + 1)


def main():
	n = int(input())
	robo_coder = list(map(int, input().split()))
	bionic_silver = list(map(int, input().split()))
	print(min_val(robo_coder, bionic_silver, n))

def min_val(robo_coder, bionic_silver, n):
	rc = 0
	bs = 0
	min_val = 0
	i = 0
	while i in range(n):
		if robo_coder[i] and (not bionic_silver[i]):
			rc += 1
		if not robo_coder[i] and bionic_silver[i]:
			bs += 1
		i += 1
	if not rc:
		return -1
	while min_val * rc <= bs:
		min_val += 1
	return min_val
main()


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = cnta = cntb = 0
for i in range(n):
	if a[i] == b[i] and a[i]:
		cnt += 1
	elif a[i]:
		cnta += 1
	elif b[i]:
		cntb += 1
if cnta:
	for i in range(1, 101, 1):
		if cnta * i - cntb > 0:
			print(i)
			break
else:
	print(-1)


t = int(input())
z = list(map(int, input().split()))
w = list(map(int, input().split()))
if z == w:
	print('-1')
else:
	x = 0
	b = 1
	a = sum(w) - sum(z)
	for i in range(t):
		if z[i] == 1 and w[i] == 0:
			x = x + 1
	for j in range(t):
		if z[j] == 0 and w[j] == 1:
			b = b + 1
	if x == 0:
		print('-1')
	elif b % x == 0:
		print(b // x)
	else:
		print(b // x + 1)


import os, sys
if os.path.exists('inp.txt'):
	sys.stdin = open('inp.txt', 'r')

def _():
	return sys.stdin.readline()

def __():
	return sys.stdin.readline().split()
maxn = 200005
n = int(_())
(res, ans) = (0, 0)
a = list(map(int, __()))
b = list(map(int, __()))
for i in range(n):
	if a[i] > b[i]:
		ans += 1
	elif a[i] < b[i]:
		res += 1
if not ans:
	print(-1)
	exit(0)
print(1 if res < ans else int((res - ans) / ans) + 2)


n = int(input())
rc = [int(i) for i in input().split()]
bs = [int(i) for i in input().split()]
r = 0
b = 0
for a in range(n):
	if rc[a] > bs[a]:
		r += 1
	elif rc[a] < bs[a]:
		b += 1
if r == 0:
	print(-1)
else:
	print(b // r + 1)


from math import ceil
inf = int(10000000000.0)
t = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rr = 0
bb = 0
for i in range(t):
	if r[i] > b[i]:
		rr += 1
	elif r[i] < b[i]:
		bb += 1
if rr:
	print(ceil((bb + 1) / rr))
else:
	print(-1)


n = int(input())
r = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
cnt = 0
p = 0
for i in range(0, n):
	if b[i] == 1 and r[i] == 0:
		cnt += 1
	elif b[i] == 0 and r[i] == 1:
		p += 1
if p == 0:
	print(-1)
elif cnt < p:
	print(1)
else:
	print(cnt // p + 1)


n = int(input())
(f, s) = (0, 0)
for (i, j) in zip(input(), input()):
	if i == '1' and i != j:
		f += 1
	elif j == '1' and j != i:
		s += 1
print(s // f + 1) if f != 0 else print(-1)


from math import ceil
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(a1, b1) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		a1 += 1
	elif a[i] == 0 and b[i] == 1:
		b1 += 1
if a1 == 0:
	print(-1)
elif a1 > b1:
	print(1)
elif a1 == b1:
	print(2)
else:
	x = b1 - a1 + 1
	print(1 + ceil(x / a1))


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def sum(n):
	pow = math.floor(math.log2(n))
	print(pow)
	sum = n * (n + 1) / 2 - 2 * (2 ** (pow + 1) - 1)
	return int(sum)
n = inp()
r = inlt()
b = inlt()
winr = 0
winb = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		winr += 1
	elif r[i] == 0 and b[i] == 1:
		winb += 1
if winr == 0:
	print(-1)
else:
	print(math.floor(winb / winr) + 1)


import math

def calc(robot1, robot2, n):
	higher_2 = higher_1 = 0
	poss = False
	for i in range(n):
		if robot1[i] > robot2[i]:
			poss = True
			higher_1 += 1
		elif robot2[i] > robot1[i]:
			higher_2 += 1
	if not poss:
		return -1
	has = math.ceil(higher_2 / higher_1)
	if has * higher_1 == higher_2:
		return has + 1
	else:
		return has
n = int(input())
robot1 = list(map(int, input().split()))
robot2 = list(map(int, input().split()))
print(calc(robot1, robot2, n))


from sys import stdin
input = stdin.readline
input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_only = b_only = 0
for (i, j) in zip(a, b):
	if i == j:
		continue
	if i == 1:
		a_only += 1
	elif j == 1:
		b_only += 1
if a_only == 0:
	print(-1)
else:
	print(b_only // a_only + 1)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	n = mint()
	r = list(mints())
	b = list(mints())
	c = [[0, 0], [0, 0]]
	for i in range(n):
		c[r[i]][b[i]] += 1
	h = c[0][1]
	w = c[1][0]
	if w == 0:
		print(-1)
	else:
		r = h // w
		while r * w <= h:
			r += 1
		print(r)
solve()


try:
	n = int(input())
	l = list(map(int, input().split()))
	m = list(map(int, input().split()))
	c = d = 0
	for (i, j) in zip(l, m):
		if i > j:
			c = c + 1
		elif i < j:
			d = d + 1
		else:
			pass
	if c == 0 and d == 0 or c == 0:
		print(-1)
	else:
		print(d // c + 1)
except:
	pass


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(cntA, cntB) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		cntA += 1
	elif a[i] == 0 and b[i] == 1:
		cntB += 1
if cntA == 0:
	print(-1)
else:
	print(cntB // cntA + 1)


from math import ceil, floor
for _ in range(1):
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	for i in range(n):
		if r[i] != 1 and r[i] != b[i]:
			count += 1
	if sum(r) > sum(b):
		print(1)
	else:
		count += 1
		r_count = 0
		ss = 0
		for i in range(n):
			if r[i] == 1 and r[i] != b[i]:
				r_count += 1
			if r[i] == 1 and b[i] == 1:
				ss += 1
		try:
			ans = count // r_count
			k = count % r_count
			if k > 0 and k <= r_count:
				ans += 1
			elif k > 0 and k > r_count:
				ans += ceil(k / r_count)
			print(ans)
		except:
			print(-1)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
n = ii()
a = li()
b = li()
ar = br = 0
for i in range(n):
	if a[i] == 1 != b[i]:
		ar += 1
	elif b[i] == 1 != a[i]:
		br += 1
if ar == 0:
	print(-1)
else:
	print(ceil(br + 1, ar))


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
c = 0
d = 0
while i < n:
	if a[i] > b[i]:
		c += 1
	if b[i] > a[i]:
		d += 1
	i += 1
if c == 0:
	print(-1)
elif c > d:
	print(1)
elif c == d:
	print(2)
else:
	print(int(math.ceil((d + 1) / c)))


def MaxCheat(advantages, disadvantages):
	if advantages:
		return disadvantages // advantages + 1
	else:
		return -1
assert MaxCheat(1, 0) == 1
assert MaxCheat(45, 0) == 1
assert MaxCheat(1, 1) == 2
assert MaxCheat(42, 42) == 2
assert MaxCheat(1, 3) == 4
assert MaxCheat(2, 3) == 2
assert MaxCheat(3, 20) == 7
assert MaxCheat(3, 21) == 8
count = input()
winner = list(map(int, input().split()))
louser = list(map(int, input().split()))
advantages = 0
disadvantages = 0
for (w, l) in zip(winner, louser):
	advantages += 1 if w > l else 0
	disadvantages += 1 if l > w else 0
print(MaxCheat(advantages, disadvantages))


t = int(input())
l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
(first, second) = (0, 0)
for x in range(len(l1)):
	if l1[x] and (not l2[x]):
		first += 1
	elif l2[x] and (not l1[x]):
		second += 1
targ = second + 1
if first == 0:
	print(-1)
else:
	print(int(targ / first) + int(targ % first != 0))


n = int(input())
r = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
(r1, b1) = (set(), set())
for i in range(len(r)):
	if r[i] == 1:
		r1.add(i)
for i in range(len(b)):
	if b[i] == 1:
		b1.add(i)
if len(r1 - b1) == 0:
	print(-1)
else:
	s = r1 - b1
	n1 = len(s)
	n2 = len(b1) - len(r1) + 1
	if n2 // n1 == n2 / n1:
		a = n2 // n1
	else:
		a = n2 // n1 + 1
	a += 1
	print(a)


count_of_ex = int(input())
rob1 = [int(x) for x in input().split()]
rob2 = [int(x) for x in input().split()]
rob1_dom = 0
rob2_dom = 0
i = 0
while i < count_of_ex:
	if rob2[i] > rob1[i]:
		rob2_dom += 1
	elif rob1[i] > rob2[i]:
		rob1_dom += 1
	i += 1
if rob1_dom == 0:
	print(-1)
elif rob1_dom > rob2_dom:
	print(1)
else:
	print(rob2_dom // rob1_dom + 1)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(x, y) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		x += 1
	elif a[i] == 0 and b[i] == 1:
		y += 1
if x == 0:
	print(-1)
else:
	ans = y // x + 1
	print(ans)


n = int(input())
r = [int(n) for n in input().split(' ')]
b = [int(n) for n in input().split(' ')]
points = list(range(n))
a_win = list()
b_score = 0
draw_score = 0
for i in range(n):
	if r[i] > b[i]:
		a_win.append(i)
	elif r[i] < b[i]:
		b_score += 1
		points[i] = 1
	else:
		points[i] = 1
		draw_score += 1
if draw_score < n and len(a_win) > 0:
	need_score = b_score + 1
	for x in range(len(a_win)):
		ai_score = int(need_score / len(a_win))
		qi = a_win.pop(0)
		points[qi] = ai_score
		need_score -= ai_score
	print(max(points))
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 1
res = sec = 0
for i in range(n):
	if a[i] and b[i] == 0:
		res += 1
	if b[i] and a[i] == 0:
		sec += 1
if res == 0:
	exit(print(-1))
print(sec // res + 1)


def main():
	n = int(input())
	RCI_sol = list(map(int, input().split()))
	BSI_sol = list(map(int, input().split()))
	points_set = [1] * n
	res = -1
	while True:
		if sum(RCI_sol) == n and sum(BSI_sol) == n:
			break
		if sum(RCI_sol) == 0:
			break
		sum_RCI = 0
		sum_BSI = 0
		for i in range(n):
			sum_RCI += RCI_sol[i] * points_set[i]
			sum_BSI += BSI_sol[i] * points_set[i]
		if sum_RCI > sum_BSI:
			res = max(points_set)
			break
		flag = False
		for i in range(n):
			if RCI_sol[i] == 1 and BSI_sol[i] == 0:
				points_set[i] += 1
				flag = True
		if flag is False:
			break
	print(res)
main()


import sys
import math
input = lambda : sys.stdin.readline().rstrip()
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
s2 = 0
s1 = 0
s3 = 0
s4 = 0
for i in range(n):
	if b[i] == 1:
		s2 += 1
	if r[i] == 1:
		s1 += 1
	if r[i] == 1 and b[i] == 0:
		s3 += 1
	if r[i] == 0 and b[i] == 1:
		s4 += 1
if s1 == 0 or s2 == n or s3 == 0:
	print(-1)
else:
	ans = 1
	ans += s4 // s3
	print(ans)


import math
cntr = 0
cntb = 0
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		cntb = cntb + 1
	if r[i] == 1 and b[i] == 0:
		cntr = cntr + 1
if r == b or cntr == 0:
	print('-1')
else:
	delta = cntb - cntr + 1
	if delta < 1:
		print('1')
	else:
		delta = math.ceil(delta / cntr)
		print(delta + 1)


def min_possible(robo, bionic, n):
	robosolved = [robo[i] for i in range(n) if bionic[i] == 0 and robo[i] == 1]
	bionicsolved = [bionic[i] for i in range(n) if robo[i] == 0 and bionic[i] == 1]
	if not robosolved:
		return -1
	if len(bionicsolved) < len(robosolved):
		return 1
	(q, r) = divmod(len(bionicsolved), len(robosolved))
	return q + 1
n = int(input())
robo = list(map(int, input().split()))
bionic = list(map(int, input().split()))
print(min_possible(robo, bionic, n))


I = lambda : map(int, input().split())
n = int(input())
a = list(zip(I(), I()))
x = a.count((1, 0))
if x > 0:
	y = a.count((0, 1))
	if x > y:
		print(1)
	else:
		print((y + 1 + x - 1) // x)
else:
	print(-1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
c1 = 0
c2 = 0
c = 1
for i in range(n):
	if l1[i] != l2[i]:
		if l1[i] == 1:
			c1 += 1
		elif l2[i] == 1:
			c2 += 1
if c1 == 0:
	print('-1')
elif sum(l1) == 0:
	print('-1')
else:
	while c1 * c <= c2:
		c += 1
	print(c)


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
(k1, k0, km) = (0, 0, 0)
for i in range(n):
	t = a[i] - b[i]
	if t == 1:
		k1 += 1
	elif t == 0:
		k0 += 1
	else:
		km += 1
if k1 == 0:
	print(-1)
else:
	print(km // k1 + 1)


import math
n = int(input())
rc = list(map(int, input().split()))
bs = list(map(int, input().split()))
sum_rc = sum(rc)
sum_bs = sum(bs)
if sum_rc > sum_bs:
	print(1)
else:
	only_rc = 0
	only_bs = 0
	for i in range(n):
		if rc[i] == 1 and bs[i] == 0:
			only_rc += 1
		if rc[i] == 0 and bs[i] == 1:
			only_bs += 1
	if only_rc == 0:
		print(-1)
	else:
		print(only_bs // only_rc + 1)


n = int(input())
ar = list(map(int, input().split()))
ar1 = list(map(int, input().split()))
count1 = 0
count2 = 0
for (i, j) in zip(ar, ar1):
	if i > j:
		count1 += 1
	elif i < j:
		count2 += 1
if count1 == 0:
	print(-1)
else:
	print(count2 // count1 + 1)


n = int(input())
q = input().split(' ')
r = list()
b = list()
winr = 0
winb = 0
k = 0
f = 1
for i in range(n):
	r.append(int(q[i]))
q = input().split(' ')
for i in range(n):
	b.append(int(q[i]))
for i in range(n):
	if r[i] == 1 and b[i] != r[i]:
		k += 1
	elif b[i] != r[i] and r[i] == 0:
		f += 1
if k == 0:
	print(-1)
elif f % k == 0:
	print(f // k)
else:
	print(f // k + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
	print(-1)
else:
	for i in range(len(a)):
		if a[i] == b[i]:
			a[i] = b[i] = 0
	if a.count(1) == 0:
		print(-1)
	else:
		print(b.count(1) // a.count(1) + 1)


import sys
input = sys.stdin.readline
n = int(input())
type1 = [int(x) for x in input().split()]
type2 = [int(x) for x in input().split()]
(onlyfirst, onlysecond) = (0, 0)
for i in range(n):
	if type1[i] == 1 and type2[i] == 0:
		onlyfirst += 1
	elif type1[i] == 0 and type2[i] == 1:
		onlysecond += 1
if onlyfirst == 0:
	print(-1)
	exit()
k = onlysecond // onlyfirst
print(k + 1)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aa = 0
bb = 0
common = 0
for i in range(n):
	if a[i] == 1 and b[i] == 1:
		common += 1
	elif a[i] == 1:
		aa += 1
	elif b[i] == 1:
		bb += 1
if aa == 0 and common == 0:
	print(-1)
elif aa == 0:
	print(-1)
else:
	extra = bb + 1
	print(math.ceil(extra / aa))


import math
robo = []
oth = []
n = input()
robo = [int(x) for x in input().split()]
oth = [int(x) for x in input().split()]
scorea = 0
scoreb = 0
for i in range(len(robo)):
	if robo[i] > oth[i]:
		scorea = scorea + 1
	if oth[i] > robo[i]:
		scoreb = scoreb + 1
if scorea == 0:
	print(-1)
elif scorea > scoreb:
	print(1)
else:
	p1 = scoreb + 1
	print(math.ceil(p1 / scorea))


n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
c1 = 0
c2 = 0
for i in range(n):
	if arr1[i] == 1 and arr2[i] == 0:
		c1 += 1
	if arr1[i] == 0 and arr2[i] == 1:
		c2 += 1
if c1 == 0:
	print(-1)
elif c2 == 0:
	print(1)
else:
	ans = c2 // c1
	print(ans + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
least_points = 0
for i in range(1, n + 1, 1):
	r_sum = 0
	b_sum = 0
	for j in range(n):
		if r[j] == 0:
			if b[j] == 1:
				b_sum += 1
		else:
			r_sum += i
			if b[j] == 1:
				b_sum += i
		if j == n - 1 and r_sum > b_sum:
			least_points = i
		if least_points != 0:
			break
if least_points == 0:
	print(-1)
else:
	print(least_points)


n = int(input())
w = list(map(int, input().split()))
l = list(map(int, input().split()))
unsol = 0
sol = 0
for i in range(n):
	if w[i] == 1 and l[i] == 0:
		sol += 1
	elif w[i] == 0 and l[i] == 1:
		unsol += 1
if sol == 0:
	print(-1)
else:
	print(unsol // sol + 1)


n = int(input())
lis1 = [int(x) for x in input().split()]
lis2 = [int(x) for x in input().split()]
(a, b) = (0, 0)
for i in range(n):
	if lis1[i] > lis2[i]:
		a += 1
	if lis1[i] < lis2[i]:
		b += 1
if a == 0:
	print(-1)
	exit(0)
print(b // a + 1)


def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))
n = int(input())
r = liis()
b = liis()
count = 0
for i in range(len(r)):
	if r[i] == 1 and b[i] == 0:
		count += 1
if count == 0:
	print(-1)
elif sum(r) > sum(b):
	print(1)
else:
	i = 0
	count_p = 1
	while sum(b) - (sum(r) + i) >= 0:
		i += count
		count_p += 1
	print(count_p)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
(cr, cb) = (0, 0)
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		cr += 1
	if b[i] == 1 and r[i] == 0:
		cb += 1
if cr + cb == 0 or cr == 0:
	print(-1)
else:
	print(math.ceil((cb + 1) / cr))


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	n = inin()
	a = ain()
	b = ain()
	x = c = 0
	for i in range(n):
		if a[i] < b[i]:
			x += 1
		elif a[i] > b[i]:
			c += 1
	x += 1
	if c > 0:
		print(math.ceil(x / c))
	else:
		print(-1)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


input()
x = list(map(int, input().split()))
y = list(map(int, input().split()))
a0 = sum((i & ~j for (i, j) in zip(x, y)))
a1 = sum((j & ~i for (i, j) in zip(x, y)))
try:
	print(a1 // a0 + 1)
except ZeroDivisionError:
	print(-1)


x = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = 0
q = 0
v = 1
for i in range(x):
	if a[i] == 1 and b[i] == 0:
		p += 1
	if a[i] == b[i] == 1:
		q += 1
if p == 0 or a == b or b.count(1) == x:
	exit(print(-1))
while 1 == 1:
	if a.count(1) * v > q * v + b.count(1) - q:
		exit(print(v))
	v += 1


n = int(input())
r1 = list(map(int, input().split()))
r2 = list(map(int, input().split()))
dup1 = []
dup2 = []
d = 0
sum1 = 0
sum2 = 0
a = 0
if sum(r1) == sum(r2) and sum(r1) == n:
	print(-1)
	d = 1
elif sum(r1) == sum(r2) and sum(r1) == 0:
	print(-1)
	d = 1
if d == 0:
	for i in range(0, n):
		if r1[i] == 0 and r2[i] == 1:
			sum2 += 1
		elif r1[i] == 1 and r2[i] == 1:
			sum1 += 1
			sum2 += 1
		elif r1[i] == 1 and r2[i] == 0:
			dup1.append(r1[i])
			dup2.append(r2[i])
	for i in range(0, 100):
		if sum1 + sum(dup1) * (i + 1) > sum2:
			print(i + 1)
			a = 1
			break
	if a == 0:
		print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
mark = 0
sum1 = 0
sum2 = 0
cnt = 0
for i in range(n):
	if a[i] != b[i] and a[i] > 0:
		mark = 1
		cnt += 1
	if a[i] > 0:
		sum1 += a[i]
	if b[i] > 0:
		sum2 += b[i]
if mark == 1:
	if sum1 > sum2:
		print(1)
	else:
		x = int(sum2 - sum1 + 1)
		if x <= cnt:
			print(2)
		elif cnt == 1:
			print(x + 1)
		else:
			if x % cnt == 0:
				x = int(x / cnt)
			else:
				x = int(x / cnt)
				x += 1
			print(x + 1)
else:
	print(-1)


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
ctr = 1
share = 0
for i in range(n):
	if r[i] < b[i]:
		ctr += 1
	elif r[i] > b[i]:
		share += 1
if share == 0:
	print(-1)
else:
	(score, rem) = divmod(ctr, share)
	if rem == 0:
		print(score)
	else:
		print(score + 1)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
onr = 0
onb = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		onr += 1
	elif r[i] == 0 and b[i] == 1:
		onb += 1
if onr == 0:
	print(-1)
elif onr > onb:
	print(1)
elif onb % onr != 0:
	print(math.ceil(onb / onr))
else:
	print(onb // onr + 1)


n = int(input())
uniquecolrobo = 0
uniquecolbionic = 0
ans = 1
robocoder = list(map(int, input().split()))
bionicsolver = list(map(int, input().split()))
for i in range(n):
	if robocoder[i] == 1 and bionicsolver[i] == 0:
		uniquecolrobo += 1
	elif robocoder[i] == 0 and bionicsolver[i] == 1:
		uniquecolbionic += 1
c = 0
if uniquecolrobo == 0:
	ans = -1
else:
	while c * uniquecolrobo <= uniquecolbionic:
		c += 1
	ans = c
print(ans)


n = int(input())
a = input().split(' ')
a = list(map(int, a))
b = input().split(' ')
b = list(map(int, b))
num1 = 0
num2 = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		num1 += 1
	if a[i] == 0 and b[i] == 1:
		num2 += 1
if num1 == 0:
	print(-1)
else:
	print((num2 + num1) // num1)


from math import *
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = []
c = 0
s = 0
for i in range(n):
	l.append(a[i] - b[i])
	if l[i] == 1:
		c = c + 1
	elif l[i] == -1:
		s = s + 1
if c == 0:
	print('-1')
else:
	print(s // c + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
p = -1
countloss = 0
countwin = 0
d = [0] * n
for i in range(n):
	d[i] = r[i] - b[i]
	if d[i] == -1:
		countloss += 1
	elif d[i] == 1:
		countwin += 1
if d != [0] * n:
	if countwin != 0:
		p = countloss // countwin + 1
print(p)


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def prost(x):
	d = math.sqrt(x)
	d = int(d) + 1
	for i in range(2, d):
		if x % i == 0:
			return False
	return True

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
k1 = r.count(1)
k2 = b.count(1)
if k1 == 0:
	print(-1)
else:
	k1 = 0
	k11 = 0
	k2 = 0
	k22 = 0
	for i in range(n):
		if r[i] == 1 and b[i] != 1:
			k1 += 1
		if r[i] == 1:
			k11 += 1
		if r[i] != 1 and b[i] == 1:
			k2 += 1
		if b[i] == 1:
			k22 += 1
	if k1 == 0:
		print(-1)
	else:
		d = k2 + 1
		ans = d // k1
		if d % k1 != 0:
			ans += 1
		print(ans)


import math
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
sa = 0
sb = 0
for i in range(n):
	if a[i] > b[i]:
		sa += 1
	elif a[i] < b[i]:
		sb += 1
if sa == 0:
	ans = -1
else:
	ans = math.ceil(sb // sa) + 1
print(ans)


n = int(input())
li = list(map(int, input().split()))
lii = list(map(int, input().split()))
a = 0
b = 0
for i in range(n):
	if li[i] == 1 and lii[i] == 0:
		a += 1
	elif lii[i] == 1 and li[i] == 0:
		b += 1
if a == 0:
	print(-1)
else:
	print(b // a + 1)


import math

class Solution:

	def value(self, n, r, b) -> int:
		(count, counte) = (0, 0)
		for i in range(n):
			if r[i] == 0 and b[i] == 1:
				count += 1
			elif r[i] == 1 and b[i] == 0:
				counte += 1
		count += 1
		if not counte:
			return -1
		return math.ceil(count / counte)
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
obj = Solution()
print(obj.value(n, r, b))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
d = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		c = c + 1
	elif a[i] == 0 and b[i] == 1:
		d = d + 1
if c == 0:
	print(-1)
elif c > d:
	print(1)
else:
	for i in range(2, 101):
		if c * i > d:
			print(i)
			break


import sys, os, io
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ca = 0
cb = 0
flag = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		flag = 1
		ca += 1
	elif a[i] == 0 and b[i] == 1:
		flag = 1
		cb += 1
if ca == 0:
	print(-1)
elif cb < ca:
	print(1)
else:
	cb += 1
	if cb % ca == 0:
		print(cb // ca)
	else:
		print(cb // ca + 1)


n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
(q, sec) = (0, 0)
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		q += 1
	elif a[i] == 0 and b[i] == 1:
		sec += 1
if q == 0:
	print('-1')
else:
	p = 1
	while True:
		if q * p > sec:
			print(p)
			exit()
		p += 1


import math
n_battle = int(input().strip())
r_points = list(map(int, input().strip().split()))
b_points = list(map(int, input().strip().split()))
r_cnt = sum([1 for i in range(n_battle) if r_points[i] == 1 and b_points[i] == 0])
b_cnt = sum([1 for i in range(n_battle) if r_points[i] == 0 and b_points[i] == 1])
if r_cnt == 0 or b_cnt == n_battle:
	print(-1)
else:
	print(math.ceil((b_cnt + 1) / r_cnt))


def main():
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a = set()
	c = set()
	for i in range(n):
		if r[i] == 1:
			a.add(i)
		if b[i] == 1:
			c.add(i)
	t = a - c
	diff = len(c) - len(a)
	if diff >= 0:
		l = len(t)
		if l != 0:
			print(diff // l + 2)
		else:
			print(-1)
	else:
		print(1)
main()


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
if r == b:
	print('-1')
elif sum(r) > sum(b):
	print('1')
else:
	rs = sum(r)
	bs = sum(b)
	ct = 0
	for j in range(n):
		if r[j] == 1 and b[j] == 0:
			ct += 1
	if ct == 0:
		print('-1')
	elif (bs - rs) % ct == 0:
		print((bs - rs) // ct + 2)
	else:
		print(int((bs - rs) / ct) + 2)


import math as m
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
(c1, c2) = (0, 0)
for i in range(n):
	if l1[i] != l2[i]:
		if l1[i] == 1:
			c1 += 1
		else:
			c2 += 1
if c1 != 0:
	print(c2 // c1 + 1)
else:
	print(-1)


import sys
input = sys.stdin.readline
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
(sum, cnt) = (0, 0)
for i in range(n):
	sum += int(1 - r[i] and b[i])
	cnt += int(r[i] and 1 - b[i])
print(-1 if cnt == 0 else sum // cnt + 1)


n = int(input())
(*r,) = map(int, input().split())
(*b,) = map(int, input().split())
if sum(r) > sum(b):
	print(1)
else:
	(t, u) = (0, 0)
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			t += 1
		elif r[i] == 0 and b[i] == 1:
			u += 1
	if t == 0:
		print(-1)
	else:
		print(u // t + 1)


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
r1 = 0
b1 = 0
for j in range(n):
	if r[j] != b[j]:
		if r[j] == 1:
			r1 += 1
		else:
			b1 += 1
if r1 == 0:
	print(-1)
else:
	print(b1 // r1 + 1)


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
(c, d) = (0, 0)
for x in range(n):
	if a[x] == b[x]:
		continue
	if a[x] > b[x]:
		c += 1
	else:
		d += 1
print(-1 if c == 0 else d // c + 1)


n = int(input())
rs = map(int, input().split())
bs = map(int, input().split())
f = 0
s = 0
for (r, b) in zip(rs, bs):
	if r == 0 and b == 1:
		s += 1
	elif r == 1 and b == 0:
		f += 1
if f == 0:
	print(-1)
else:
	print((s + f) // f)


n = int(input())
r = b = 0
ra = input().split()
rb = input().split()
for i in range(n):
	if ra[i] == '1' and rb[i] == '0':
		r += 1
	elif ra[i] == '0' and rb[i] == '1':
		b += 1
if r == 0:
	print('-1')
elif r > b:
	print('1')
else:
	q = 1 + b // r
	print(q)


import math
n = int(input())
robo = list(map(int, input().split()))
bionic = list(map(int, input().split()))
robototal = 0
bionictotal = 0
for e in range(n):
	if robo[e]:
		if not bionic[e]:
			robototal += 1
	elif bionic[e]:
		bionictotal += 1
if robototal:
	maxi = bionictotal + 1
	print(math.ceil(maxi / robototal))
else:
	print(-1)


a = int(input())
br = []
rc = []
stbc = input()
for i in stbc.split():
	br.append(int(i))
tbc = input()
for i in tbc.split():
	rc.append(int(i))
if br.count(1) > rc.count(1):
	print(1)
else:
	for i in range(a):
		if br[i] == rc[i]:
			br[i] = -1
			rc[i] = -1
	bro = br.count(1)
	rco = rc.count(1)
	if bro == 0:
		print(-1)
	else:
		print(int(rco / bro + 1))


import sys
import math

def fast_input():
	return sys.stdin.readline().strip()

def data_input():
	return [int(x) for x in fast_input().split()]

def binary_search(array, x):
	(left, right) = (-1, len(array))
	while left + 1 != right:
		middle = (left + right) // 2
		if array[middle] >= x:
			right = middle
		elif array[middle] < x:
			left = middle
	return right

def solve_of_problem():
	n = int(fast_input())
	r1 = data_input()
	b = data_input()
	(o, r, count) = (0, 0, 0)
	for i in range(n):
		if b[i] == 1 and r1[i] == 0:
			count += 1
		elif r1[i] == 1 and b[i] == 0:
			r += 1
	if r == 0:
		print(-1)
		return
	print((r + count) // r)
	return
for ______ in range(1):
	solve_of_problem()


a = input()
a = int(a)
r1 = input()
r2 = input()
r1m = r1.split()
r2m = r2.split()
z1 = 0
z2 = 0
v = 0
for i in range(a):
	if int(r1m[i]) > int(r2m[i]):
		z1 += 1
	if int(r1m[i]) < int(r2m[i]):
		z2 += 1
if z1 > z2:
	print('1')
if z1 <= z2:
	if z1 <= 0:
		print('-1')
	else:
		v = round(z2 / z1 + 0.5)
		if v * z1 == z2:
			v += 1
		print(v)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(x, y) = (0, 0)
ok = False
for i in range(len(a)):
	if a[i] > b[i]:
		x += 1
	elif b[i] > a[i]:
		y += 1
temp = x
for i in range(1, 1000):
	x = temp * i
	if x > y:
		ok = True
		break
print(i if ok else -1)


def frog(a, b):
	m = []
	k = 0
	n = []
	c = 0
	for r in range(len(b)):
		if b[r] == 1:
			c += 1
		if b[r] == 0:
			n.append(r)
	for x in n:
		m.append(a[x])
		a[x] = 0
	k = sum(a)
	r = sum(m)
	q = c - k + 1
	if q < 0:
		return 1
	if r == 0:
		return -1
	if q % r == 0:
		return q // r
	else:
		return q // r + 1
	return max(z) + 1
a = int(input())
arr = list(map(int, input().rstrip().split()))
brr = list(map(int, input().rstrip().split()))
t = frog(arr, brr)
print(t)


from sys import stdin
from math import ceil

def arr_inp(n):
	if n == 1:
		return [int(x) for x in stdin.readline().split()]
	elif n == 2:
		return [float(x) for x in stdin.readline().split()]
	else:
		return list(stdin.readline()[:-1])
(n, a, b, sa, sb) = (int(input()), arr_inp(1), arr_inp(1), 0, 0)
for i in range(n):
	if a[i] and (not b[i]):
		sa += 1
	elif b[i] and (not a[i]):
		sb += 1
if sa == sb == 0:
	print(-1)
elif sa > sb:
	print(1)
else:
	try:
		print(sb // sa + 1)
	except:
		print(-1)


n = int(input())
r = [int(r) for r in input().split()]
b = [int(b) for b in input().split()]
cntr = cntb = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		cntr += 1
	elif r[i] == 0 and b[i] == 1:
		cntb += 1
if cntr == n and cntb == n:
	print(-1)
elif cntr == 0:
	print(-1)
elif cntr > cntb:
	print(1)
else:
	print(cntb // cntr + 1)


from collections import defaultdict as dd
from collections import Counter as ccd
from itertools import permutations as pp
from itertools import combinations as cc
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq as hq
from math import gcd
mod = pow(10, 9) + 7

def inp(flag=0):
	if flag == 0:
		return list(map(int, input().strip().split(' ')))
	else:
		return int(input())
n = inp(1)
a = inp()
b = inp()
lose = 0
win = 0
draw = 0
for i in range(n):
	if a[i] == b[i]:
		if a[i] == 0:
			continue
		else:
			draw += 1
	elif a[i] == 1:
		win += 1
	else:
		lose += 1
if win == 0:
	print(-1)
elif win > lose:
	print(1)
elif win == lose:
	print(2)
else:
	if (lose + 1) % win == 0:
		ans = (lose + 1) // win
	else:
		ans = 1 + (lose + 1) // win
	print(ans)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cnt_lost = 0
	cnt_win = 0
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			cnt_win += 1
		elif a[i] == 0 and b[i] == 1:
			cnt_lost += 1
	if cnt_win == 0 and cnt_lost >= 0:
		print(-1)
	else:
		print(max(1, cnt_lost // cnt_win + 1))
main()


n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
solor = 0
for i in range(n):
	if r[i] and (not b[i]):
		solor += 1
if sum(r) > sum(b):
	print(1)
elif solor == 0 and sum(b) >= sum(r):
	print(-1)
else:
	dif = sum(b) - sum(r)
	print(1 + (dif + 1 + solor - 1) // solor)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rs = sum(r)
bs = sum(b)
a = sum([e1 * (1 - e2) for (e1, e2) in zip(r, b)])
c = sum([(1 - e1) * e2 for (e1, e2) in zip(r, b)])
if rs > bs:
	print(1)
elif bs >= rs and a > 0:
	print((bs - rs) // a + 2)
else:
	print(-1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
diff = 0
div = 0
i = 0
while i < n:
	if r[i] == 1 or b[i] == 1:
		if r[i] == 1 and b[i] == 0:
			diff += 1
		elif r[i] == 0 and b[i] == 1:
			diff += 1
	if r[i] == 1 and b[i] == 0:
		div += 1
	i += 1
if div > 0:
	print(diff // div)
else:
	print(-1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
flag = 0
for i in range(n):
	if r[i] != b[i]:
		flag = 1
		break
if flag == 0:
	print(-1)
	exit()
diff1 = 0
diff2 = 0
for i in range(n):
	if r[i] != b[i] and r[i] == 1:
		diff1 += 1
	elif r[i] != b[i] and r[i] == 0:
		diff2 += 1
if diff1 > diff2:
	print(1)
else:
	if diff1 == 0:
		print(-1)
		exit()
	print(diff2 // diff1 + 1)


n = int(input())
l1 = list(map(int, input().split(' ')))
l2 = list(map(int, input().split(' ')))
(a, b) = (0, 0)
for i in range(0, len(l1)):
	if l1[i] > l2[i]:
		a += 1
	elif l2[i] > l1[i]:
		b += 1
if a == 0:
	print('-1')
	exit(0)
print(b // a + 1)


n = int(input())
r = (int(i) for i in input().split())
b = (int(i) for i in input().split())
(rs, bs) = (0, 0)
for (r, b) in zip(r, b):
	rs += r > b
	bs += b > r
res = -1 if rs == 0 else (bs + rs) // rs
print(res)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
if r == b:
	print(-1)
else:
	bi = 0
	both = 0
	ri = 0
	for i in range(n):
		if b[i]:
			bi += 1
		if b[i] == 1 and r[i] == 1:
			both += 1
		if r[i]:
			ri += 1
	need = bi + 1
	if ri > both:
		ans = math.ceil((need - both) / (ri - both))
		print(ans)
	else:
		print(-1)


import math

def solve(n, r_s, b_s):
	r_wins = 0
	b_wins = 0
	for i in range(n):
		if r_s[i] == b_s[i]:
			continue
		if r_s[i] == 1:
			r_wins += 1
		if b_s[i] == 1:
			b_wins += 1
	if r_wins == 0:
		return -1
	req_pts = b_wins + 1
	p_max = math.ceil(req_pts / r_wins)
	return p_max
n = int(input())
r_s = [int(ch) for ch in input().split(' ')]
b_s = [int(ch) for ch in input().split(' ')]
print(solve(n, r_s, b_s))


n = int(input())
(*r,) = map(int, input().split())
(*d,) = map(int, input().split())
left = 0
right = 0
for (a, b) in zip(r, d):
	if a == b:
		continue
	if a:
		left += 1
	else:
		right += 1
if not left:
	print(-1)
elif not right:
	print(1)
else:
	print(right // left + 1)


N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(d, n) = (0, 0)
for i in range(N):
	if a[i] == 1 and b[i] == 0:
		d += 1
	elif a[i] == 0 and b[i] == 1:
		n += 1
if d == 0:
	print(-1)
elif n == 0:
	print(1)
else:
	print(n // d + 1)


n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
(nr, nb) = (0, 0)
for i in range(n):
	if r[i] > b[i]:
		nr += 1
	elif b[i] > r[i]:
		nb += 1
if not nr:
	print(-1)
elif nr == 1:
	print(nb + 1)
else:
	print(nb // nr + 1)


from math import ceil
n = int(input())
r = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
al = 0
bt = 0
for i in range(n):
	if r[i] - b[i] < 0:
		bt += 1
	elif r[i] - b[i] > 0:
		al += 1
if al > 0:
	x = ceil((bt + 1) / al)
	print(x)
else:
	print(-1)


import math
n = int(input())
l = list(input().split())
s = list(input().split())
c1 = 0
c2 = 0
pos = 0
for i in range(n):
	if l[i] == '1' and s[i] == '0':
		c1 += 1
	if s[i] == '1' and l[i] == '0':
		c2 += 1
c2 += 1
if c1 == 0:
	print(-1)
elif c2 % c1 == 0:
	print(c2 // c1)
else:
	print(c2 // c1 + 1)


import math
n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
d = 0
c = 0
for i in range(len(r)):
	t = 0
	if r[i] == 0:
		t = 1
		if b[i] == 1:
			d += 1
	elif b[i] == 0:
		c += 1
if not c:
	print('-1')
else:
	print(math.ceil((d + 1) / c))


n = int(input())
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
A = B = t = 0
for i in range(n):
	if a[i] > b[i]:
		A += 1
	elif a[i] < b[i]:
		B += 1
if A == 0:
	print(-1)
else:
	print(B // A + 1)


n = int(input())
R = list(map(int, input().split()))
B = list(map(int, input().split()))
score = count = 0
for i in range(n):
	if R[i] > B[i]:
		score += 1
		count += 1
	elif R[i] < B[i]:
		score -= 1
if score <= 0 and count == 0:
	print(-1)
elif score > 0:
	print(1)
elif score == -n:
	print(-1)
else:
	print(abs(score) // count + 2)


import math
n = int(input())
str1 = str(input())
str2 = str(input())
robo1 = str1.split(' ')
robo2 = str2.split(' ')
R1 = 0
R2 = 0
for i in range(n):
	if robo1[i] == '1' and robo2[i] == '0':
		R1 += 1
	if robo2[i] == '1' and robo1[i] == '0':
		R2 += 1
if R1 != 0:
	n = math.ceil(R2 / R1)
if R1 == 0:
	print(-1)
elif n == int(R2 / R1):
	print(n + 1)
else:
	print(n)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
r_ = 0
b_ = 0
for index in range(n):
	if r[index] == 0 and b[index] != 0:
		b_ += 1
	elif r[index] != 0 and b[index] == 0:
		r_ += 1
if r_ == 0:
	print(-1)
elif r_ > b_:
	print(1)
else:
	print(b_ // r_ + 1)


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')
import bisect
from math import ceil

def main():
	n = N()
	cd = list(RL())
	sl = list(RL())
	(a, b) = (0, 0)
	sm = 0
	for i in range(n):
		if cd[i] != sl[i]:
			if cd[i] == 1:
				a += 1
			elif sl[i] == 1:
				b += 1
	if a == 0 and b == 0:
		print(-1)
	elif a > b:
		print(1)
	elif a != 0:
		print(b // a + 1)
	elif a == 0:
		print(-1)
main()


from sys import stdin
input = stdin.readline
n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
x = 0
y = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		x += 1
	if b[i] == 1 and r[i] == 0:
		y += 1
if x == 0:
	print(-1)
elif x > y:
	print(1)
else:
	ans = (y + 1) // x + ((y + 1) % x > 0)
	print(ans)


from sys import stdin, stdout
import traceback
import math
read = stdin.readline
write = stdout.write
writeln = lambda x: write(str(x) + '\n')

def reads(typ=int):
	return list(map(typ, read().split()))

class Sol:

	@classmethod
	def input(cls):
		s = cls()
		return s

	def solve(self):
		n = int(read())
		rs = reads()
		bs = reads()
		count_r = 0
		count_b = 0
		for (r, b) in zip(rs, bs):
			if r > b:
				count_r += 1
			elif r < b:
				count_b += 1
		if count_r == 0:
			return -1
		return math.ceil((count_b + 1) / count_r)
try:
	writeln(Sol.input().solve())
except Exception as e:
	print('Got exception:', repr(e))
	print(traceback.format_exc())


from sys import stdin, stdout
read = lambda : map(int, stdin.readline().split())
from math import ceil
n = int(input())
(c1, c2) = (0, 0)
for i in range(n):
	r = list(read())
	b = list(read())
	for (i, j) in zip(r, b):
		c1 += i & ~j
		c2 += ~i & j
if c1 == 0:
	print(-1)
else:
	(d, m) = divmod(c2, c1)
	print(d + 1)
quit()
import sys
I = lambda : int(input())
readline = lambda : sys.stdin.readline().strip('\n')
readmap = lambda x=int: map(x, readline().split(' '))
readlist = lambda : list(map(int, sys.stdin.readline().strip('\n').split(' ')))
RM = readmap
I()
(count1, count2) = (0, 0)
for (i, j) in zip(readlist(), readlist()):
	count1 += i & ~j
	count2 += j & ~i
print(divmod(count2, count1)[0] + 1 if count1 else -1)


import sys
I = lambda : int(input())
readline = lambda : sys.stdin.readline().strip('\n')
readmap = lambda x=int: map(x, readline().split(' '))
readlist = lambda : list(map(int, sys.stdin.readline().strip('\n').split(' ')))
RM = readmap
I()
(count1, count2) = (0, 0)
for (i, j) in zip(readlist(), readlist()):
	count1 += i & ~j
	count2 += j & ~i
print(divmod(count2, count1)[0] + 1 if count1 else -1)


n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
import math
for i in range(n):
	if arr1[i] and (not arr2[i]):
		cnt1 += 1
	elif arr2[i] and (not arr1[i]):
		cnt2 += 1
if cnt1 and cnt2:
	if cnt1 > cnt2:
		print(1)
	elif cnt1 == cnt2:
		print(2)
	elif cnt1 < cnt2:
		print(math.floor(cnt2 / cnt1) + 1)
elif cnt2 and (not cnt1):
	print(-1)
elif cnt1 and (not cnt2):
	print(1)
else:
	print(-1)


import math
n = int(input())
s1 = input()
s2 = input()
r = s1.split()
b = s2.split()
rt = 0
rs = 0
bs = 0
for i in range(0, len(r)):
	if r[i] == '1' and b[i] == '0':
		rt = rt + 1
	elif r[i] == '0' and b[i] == '1':
		bs = bs + 1
	else:
		rs += 1
		bs += 1
if rt == 0:
	print(-1)
else:
	print(math.ceil((bs - rs + 1) / rt))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = y = c = 0
for i in range(n):
	x += a[i]
	y += b[i]
	if a[i] == 1 and b[i] == 0:
		c += 1
if x > y:
	print(1)
elif c == 0:
	print(-1)
else:
	print(int((y - x) / c + 2))


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
p = [0 for i in range(n)]
behind = 0
ahead = 0
for i in range(n):
	j = r[i]
	k = b[i]
	if j <= k:
		p[i] = 1
	if j < k:
		behind += 1
	if j > k:
		ahead += 1
if ahead == 0:
	print(-1)
else:
	maxi = max(1, behind // ahead + 1)
	print(maxi)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for (i, j) in zip(a, b):
	c.append(i - j)
if 1 not in c:
	print(-1)
else:
	print(c.count(-1) // c.count(1) + 1)


import math
t = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
r_c = 0
b_c = 0
both = 0
for i in range(t):
	if b[i] == 1:
		b_c += 1
	if r[i] == 1:
		r_c += 1
	if b[i] == 1 and r[i] == 1:
		both += 1
if r_c - both != 0:
	res = math.ceil((b_c - both + 1) / (r_c - both))
	print(res)
else:
	print(-1)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
from io import BytesIO, IOBase
from bisect import bisect_left

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def modpow(b, p, m):
	res = 1
	b = b % m
	while p:
		if p & 1:
			res = res * b % m
		b = b * b % m
		p >>= 1
	return res

def mod_inv(a, m):
	return modpow(a, m - 2, m)

def ncr(n, r, m):
	res = 1
	if r == 0:
		return 1
	if n - r < r:
		r = n - r
	(p, k) = (1, 1)
	while r:
		res = res % m * (n % m * mod_inv(r, m) % m) % m
		n -= 1
		r -= 1
	return res

def ncrlis(n, r, m, fact):
	return fact[n] * (mod_inv(fact[r], m) * mod_inv(fact[n - r], m)) % m % m

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = ii()
r = li()
b = li()
(nr, nb) = (0, 0)
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		nr += 1
	elif r[i] == 0 and b[i] == 1:
		nb += 1
if nr == 0:
	print(-1)
else:
	print(nb // nr + 1)


n = int(input())
(A, B, a, b) = ([], [], 0, 0)
(A, B) = (input(''), input(''))
map(int, A.split(' '), B.split(' '))
for i in range(len(A)):
	if A[i] == '1' and B[i] == '0':
		a += 1
	if A[i] == '0' and B[i] == '1':
		b += 1
if a > b:
	print('1')
elif a != 0:
	c = int((b + 1) / a)
	d = 0 if (b + 1) % a == 0 else 1
	print(c + d)
else:
	print('-1')


n = int(input())
ri = list(map(int, input().split()))
bi = list(map(int, input().split()))
rbi1 = [max(ri[i] - bi[i], 0) for i in range(n)]
rbi2 = [max(bi[i] - ri[i], 0) for i in range(n)]
num = sum(rbi1)
num2 = sum(rbi2)
if num == 0:
	print(-1)
else:
	print(num2 // num + 1)


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
(a, ab, b) = (0, 0, 0)
for i in range(n):
	if A[i] and B[i]:
		ab += 1
	elif A[i]:
		a += 1
	elif B[i]:
		b += 1
if a == 0:
	print(-1)
else:
	print(b // a + 1)


n = int(input())
r1 = input().split()
r2 = input().split()
(numW, numL) = (0, 0)
for x in range(n):
	if r1[x] == '1' and r2[x] == '0':
		numW += 1
	if r1[x] == '0' and r2[x] == '1':
		numL += 1
if numW == 0:
	print(int(-1))
else:
	print(int(numL / numW) + 1)


N = int(input())
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))
if A == B:
	print(-1)
else:
	c = 0
	k = 0
	for i in range(N):
		if A[i] == 1 and B[i] == 0:
			c += 1
		if A[i] == B[i] == 1:
			k += 1
	if c:
		print((sum(B) - k + 1 + c - 1) // c)
	else:
		print(-1)


import math
x = int(input())
RoboCoder = str(input()).split(' ')
BionicSolver = str(input()).split(' ')
totalunsRobo = 0
totalunsBionic = 0
if RoboCoder == BionicSolver:
	print(-1)
else:
	for i in range(x):
		if BionicSolver[i] == '1' and RoboCoder[i] == '0':
			totalunsBionic += 1
		if RoboCoder[i] == '1' and BionicSolver[i] == '0':
			totalunsRobo += 1
	if totalunsRobo == 0:
		print(-1)
	elif totalunsBionic == 0:
		print(1)
	else:
		print(math.floor((totalunsBionic + totalunsRobo) / totalunsRobo))


from sys import *
from math import *
from bisect import *
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
b = list(map(int, stdin.readline().split()))
x = y = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		x += 1
	if a[i] == 0 and b[i] == 1:
		y += 1
if x == 0:
	print(-1)
else:
	cnt = 0
	i = 1
	while cnt <= y:
		cnt = i * x
		i += 1
	print(i - 1)


l = int(input())
li = list(map(int, input().split()))
li1 = list(map(int, input().split()))
x = 0
y = 0
for i in range(l):
	if li[i] == 1 and li1[i] == 0:
		x = x + 1
	if li[i] == 0 and li1[i] == 1:
		y = y + 1
if x == 0:
	print(-1)
else:
	print(y // x + 1)


def solve(n, R, P):
	(r, p) = (0, 0)
	for i in range(n):
		if R[i] == 1 and P[i] == 0:
			r += 1
		if R[i] == 0 and P[i] == 1:
			p += 1
	if r == 0:
		print(-1)
		return
	p += 1
	ans = p // r + (p % r != 0)
	print(ans)

def main():
	inp = lambda : [int(x) for x in input().split()]
	n = int(input())
	R = inp()
	P = inp()
	solve(n, R, P)
main()


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
	print(-1)
ans = 0
k = []
if sum(a) > sum(b):
	print(1)
elif sum(b) >= sum(a) and a != b:
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			ans += 1
	if ans == 0:
		print(-1)
	else:
		l = (sum(b) - sum(a)) // ans + 2
		print(l)


num_prob = int(input())
bot1 = list(map(int, input().split()))
bot2 = list(map(int, input().split()))
s_num1 = bot1.count(1)
s_num2 = bot2.count(1)
first_solves = 0
for i in range(num_prob):
	if bot1[i] and (not bot2[i]):
		first_solves += 1
if first_solves == 0:
	print(-1)
elif s_num1 > s_num2:
	print(1)
else:
	diff = s_num2 - s_num1
	overcome = diff + first_solves
	print(overcome // first_solves + 1)


def listmul(a, b):
	c = []
	for i in range(len(a)):
		c.append(a[i] * b[i])
	return c
n = int(input())
r = n * [None]
b = n * [None]
p = n * [None]
for l in range(n):
	p[l] = 1
	l = l + 1
r = list(map(int, input().split()))
b = list(map(int, input().split()))
if r == b or max(r) == 0:
	print('-1')
else:
	for m in range(n):
		if r[m] == b[m] or r[m] == 0:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print(-1)
	else:
		diff = sum(listmul(r, p)) - sum(listmul(b, p))
		temp = 1
		while sum(listmul(r, p)) <= sum(listmul(b, p)):
			addval = 1 + temp
			for k in range(n):
				if sum(listmul(r, p)) <= sum(listmul(b, p)) and r[k] == 1 and (b[k] == 0):
					p[k] = addval
					k = k + 1
			temp = temp + 1
			k = 0
		print(max(p))


from math import ceil
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
countA = 0
countB = 0
for i in range(n):
	if a[i] != b[i]:
		if a[i] == 1:
			countA += 1
		elif b[i] == 1:
			countB += 1
if countA == 0:
	print(-1)
else:
	countB += 1
	ans = ceil(countB / countA)
	print(ans)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
cr = cb = 0
for i in range(n):
	if r[i] > b[i]:
		cr += 1
	if r[i] < b[i]:
		cb += 1
ans = 0
if cr == 0:
	ans = -1
elif cr > cb:
	ans = 1
else:
	for i in range(105):
		if cr * i > cb:
			ans = i
			break
print(ans)


n = int(input())
l = list(map(int, input().split()))
m = list(map(int, input().split()))
(x, y) = (0, 0)
for i in range(n):
	x += int(l[i] == 0 and m[i] == 1)
	y += int(l[i] == 1 and m[i] == 0)
if y == 0:
	print('-1')
else:
	print(x // y + 1)


n = int(input())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
(a, b) = (0, 0)
for i in range(n):
	if arr[i] > brr[i]:
		a += 1
	elif brr[i] > arr[i]:
		b += 1
if a == 0:
	print(-1)
else:
	temp = 1
	i = 1
	while True:
		temp = a * i
		if temp > b:
			break
		i += 1
	print(i)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
opp = 0
hold = 0
for i in range(n):
	if a[i] ^ b[i]:
		if a[i]:
			hold += 1
		else:
			opp += 1
if hold:
	print(opp // hold + 1)
else:
	print(-1)


def max_points(lista1, lista2):
	p1 = 0
	p2 = 0
	for i in range(len(lista1)):
		if lista1[i] == 1 and lista2[i] == 0:
			p1 += 1
		elif lista2[i] == 1 and lista1[i] == 0:
			p2 += 1
	if p1 == 0:
		return -1
	elif p1 > p2:
		return 1
	elif p1 == p2:
		return 2
	elif p2 > p1:
		return p2 // p1 + 1
n = int(input())
lista1 = input().split()
lista2 = input().split()
for i in range(n):
	lista1[i] = int(lista1[i])
	lista2[i] = int(lista2[i])
print(max_points(lista1, lista2))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
counta = 0
countb = 0
for i in range(0, len(a)):
	if a[i] == b[i]:
		pass
	elif a[i] > b[i]:
		counta += 1
	else:
		countb += 1
if counta > countb:
	print(1)
elif counta == 0:
	print(-1)
elif counta == countb:
	print(2)
else:
	print(countb // counta + 1)


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(1):
	try:
		n = int(input())
		a = read()
		b = read()
		x = 0
		y = 0
		for i in range(n):
			if a[i] == 0 and b[i] == 1:
				y += 1
			elif a[i] == 1 and b[i] == 0:
				x += 1
		if x == 0:
			print(-1)
			go()
		else:
			print(y // x + 1)
	except ZeroDivisionError:
		continue
	except Exception as e:
		print(e)
		continue


import math
n = int(input())
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
x = 0
y = 0
d = 0
e = 0
f = 0
for i in range(n):
	if a[i] == 1 and b[i] != 1:
		x += 1
	if b[i] == 1 and a[i] != 1:
		y += 1
if a.count(1) == n and b.count(1) == n:
	print(-1)
	d = 1
if a.count(0) == n and b.count(0) == n and (d != 1):
	print(-1)
	e = 1
if x == 0 and d != 1 and (e != 1):
	print(-1)
	f = 1
elif d != 1 and e != 1 and (f != 1):
	print(math.ceil((y + 1) / x))


from math import ceil
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rCount = 0
bCount = 0
for i in range(n):
	if r[i] != b[i]:
		if r[i] == 0:
			rCount += 1
		else:
			bCount += 1
if bCount == 0:
	print(-1)
else:
	print(ceil((rCount + 1) / bCount))


def main():
	from sys import stdin, stdout
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	tempA = 0
	tempB = 0
	for i in range(n):
		if a[i] ^ b[i]:
			if a[i]:
				tempA += 1
			else:
				tempB += 1
	a = tempA
	b = tempB
	if a > b:
		stdout.write('1\n')
	elif a == n and a == b or a == 0:
		stdout.write('-1\n')
	else:
		stdout.write(str(b // a + 1) + '\n')
main()


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
n = int(I1())
a = list(I())
b = list(I())
sa = sum(a)
sb = sum(b)
x = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		x += 1
if sa > sb:
	print(1)
elif sa <= sb and x == 0:
	print(-1)
else:
	y = sa - x
	y = sb - y + 1
	print(math.ceil(y / x))


T = 1
for test_no in range(T):
	n = int(input())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	(x, y) = (0, 0)
	for i in range(n):
		if l1[i] == 1 and l2[i] == 0:
			x += 1
		elif l1[i] == 0 and l2[i] == 1:
			y += 1
	if x > 0:
		print(y // x + 1)
	else:
		print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(x, y) = (0, 0)
for i in range(n):
	if a[i] == b[i]:
		continue
	if a[i] == 1:
		x += 1
	else:
		y += 1
if x == y == 0:
	print(-1)
	exit(0)
try:
	print(y // x + 1)
except:
	print(-1)


import math
n = int(input())
rl = list(map(int, input().split()))
bl = list(map(int, input().split()))
rc = 0
bc = 0
for i in range(n):
	if rl[i] == 1:
		rc += 1
	if bl[i] == 1:
		bc += 1
lc = rc
cs = 0
for i in range(n):
	if rl[i] == 1 and bl[i] == 1:
		lc -= 1
		cs += 1
if lc <= 0:
	print(-1)
else:
	mp = math.ceil((bc - cs) / lc)
	if (bc - cs) // lc == int(bc - cs) / lc:
		mp += 1
	print(mp)


import math as m
t = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(ac, bc) = (0, 0)
for j in range(len(a)):
	if a[j] == 1 and b[j] == 0:
		ac += 1
	if b[j] == 1:
		bc += 1
	if a[j] == 1 and b[j] == 1:
		bc -= 1
if ac == 0:
	print(-1)
else:
	print(m.ceil((bc + 1) / ac))


n = int(input())
rob1 = list(map(int, input().split()))
rob2 = list(map(int, input().split()))
score1 = score2 = 0
for i in range(n):
	if rob1[i] == 1 and rob2[i] == 0:
		score1 += 1
	if rob1[i] == 0 and rob2[i] == 1:
		score2 += 1
if score1 > score2:
	print(1)
elif score1 == 0:
	print(-1)
else:
	print(score2 // score1 + 1)


def main():
	input()
	robo = list(map(int, input().split()))
	bionic = list(map(int, input().split()))
	flag = False
	for index in range(len(robo)):
		if robo[index] != bionic[index]:
			flag = True
	if not flag:
		print(-1)
		exit()
	robo_sum = sum(robo)
	bionic_sum = sum(bionic)
	if robo_sum > bionic_sum:
		print(1)
		exit()
	if robo_sum == bionic_sum:
		print(2)
		exit()
	a = 0
	b = 0
	for index in range(len(robo)):
		if robo[index] != 1 and bionic[index] == 1:
			a += 1
		elif bionic[index] != 1 and robo[index] == 1:
			b += 1
	if b is not 0 and a is not 0:
		print(a // b + 1)
	else:
		print(-1)
main()


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rw = 0
bw = 0
for i in range(n):
	if r[i] > b[i]:
		rw += 1
	elif r[i] < b[i]:
		bw += 1
if rw == 0:
	ans = -1
else:
	ans = math.ceil((bw + 1) / rw)
print(ans)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = c = r = d = 0
from math import ceil
for i in range(n):
	if a[i] == 1:
		c = c + 1
	if b[i] == 1:
		r = r + 1
	if a[i] == 1 and b[i] != 1:
		l = l + 1
if l == 0:
	print('-1')
elif c == r:
	print('2')
elif c < r:
	r = r - c
	if r % l == 0:
		d = ceil(r / l) + 2
	else:
		d = ceil(r / l) + 1
	print(d)
else:
	print('1')


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
	print(-1)
else:
	p1 = 0
	p0 = 0
	pa1 = 0
	pb1 = 0
	for i in range(n):
		if a[i] == 1 and b[i] == 1:
			p1 += 1
		elif a[i] == 1 and b[i] == 0:
			pa1 += 1
		elif a[i] == 0 and b[i] == 1:
			pb1 += 1
	if pa1 != 0 and pb1 != 0:
		t = pb1 // pa1
		print(t + 1)
	elif pa1 != 0 and pb1 == 0:
		print(1)
	else:
		print(-1)


n = int(input())
mas1 = [int(k) for k in input().split()]
mas2 = [int(k) for k in input().split()]
m1 = 0
m2 = 0
for i in range(n):
	if mas1[i] == 1 and mas2[i] == 0:
		m1 += 1
	elif mas1[i] == 0 and mas2[i] == 1:
		m2 += 1
if m1 == 0:
	print(-1)
else:
	print(m2 // m1 + 1)


import math
n = int(input())
l1 = [int(x) for x in input().split()]
l2 = [int(x) for x in input().split()]
sumb = len(l2) - sum((x == y == 1 for (x, y) in zip(l1, l2))) - l2.count(0)
suma = len(l1) - sum((x == y == 1 for (x, y) in zip(l1, l2))) - l1.count(0)
if suma <= 0 or sumb < 0:
	print(-1)
else:
	x = math.ceil((1 + sumb) / suma)
	print(x)


n = int(input())
a = list(input().split())
b = list(input().split())
x = 0
y = 0
for i in range(n):
	if a[i] == '1' and b[i] == '0':
		x += 1
	elif a[i] == '0' and b[i] == '1':
		y += 1
	else:
		pass
if x == 0:
	print(-1)
elif x > y:
	print(1)
else:
	print(y // x + 1)


def solve():
	n = int(input())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	cntx = 0
	cnty = 0
	for i in range(n):
		if x[i] == 1 and y[i] != 1:
			cntx += 1
		elif x[i] != 1 and y[i] == 1:
			cnty += 1
	if cntx == cnty and cntx == n or cntx == 0:
		print(-1)
	else:
		print(cnty // cntx + 1)
for _ in range(1):
	solve()


lens = int(input())
robo = [int(x) for x in input().split()]
bion = [int(x) for x in input().split()]
(rplus, bplus) = (0, 0)
for (x, y) in zip(robo, bion):
	if not x and y:
		bplus += 1
	if x and (not y):
		rplus += 1
if rplus == 0:
	print(-1)
else:
	print(bplus // rplus + 1)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
tam = 0
dem = 0
for i in range(n):
	if a[i] > b[i]:
		tam += 1
	if a[i] < b[i]:
		dem += 1
if tam == 0:
	print(-1)
elif tam == dem:
	print(2)
elif tam > dem:
	print(1)
else:
	print(int(math.ceil((dem + 1) / tam)))


from math import floor
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
a = 0
b = 0
for i in range(n):
	if l1[i] == 1 and l2[i] == 0:
		a += 1
	elif l1[i] == 0 and l2[i] == 1:
		b += 1
if a == 0:
	print(-1)
else:
	print(floor(b / a) + 1)


n = int(input())
y = list(map(int, input().split()))
x = list(map(int, input().split()))
arr = [0] * n
i = 0
while i < n:
	if y[i] == x[i] or y[i] == 0:
		arr[i] = 1
	else:
		arr[i] = -1
	i += 1
if sum(arr) == n:
	print(-1)
else:
	s1 = sum(y)
	s = 0
	for i in arr:
		if i == -1:
			s += 1
	s1 = s1 - s
	s2 = sum(x)
	t = s2 - s1 + 1
	ans1 = t // s
	a = t % s
	if a != 0:
		ans1 += 1
	print(ans1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c1 = 0
c2 = 0
for i in range(n):
	if a[i] == 1 and b[i] == 1:
		continue
	elif a[i] == 1:
		c1 += 1
	elif b[i] == 1:
		c2 += 1
mx = 0
if c1 == 0:
	mx = -1
elif (c2 + 1) % c1 == 0:
	mx = (c2 + 1) // c1
else:
	mx = (c2 + 1) // c1
	mx += 1
print(mx)


n = int(input())
rc = list(map(int, input().split()))
bc = list(map(int, input().split()))
only_r = 0
only_b = 0
for i in range(n):
	if rc[i] == 1 and bc[i] == 1:
		continue
	elif rc[i] == 1:
		only_r += 1
	elif bc[i] == 1:
		only_b += 1
	else:
		continue
if only_r == 0:
	print(-1)
elif only_r > only_b:
	print(1)
else:
	print(only_b // only_r + 1)


n = int(input())
mass = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
first = 0
second = 0
for i in range(n):
	if mass[i] == 1 and arr[i] == 0:
		first += 1
	elif mass[i] == 0 and arr[i] == 1:
		second += 1
if first == 0:
	answer = -1
else:
	answer = second // first + 1
print(answer)


from math import ceil
n = int(input())
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
c_a = sum(a)
c_b = sum(b)
if c_a == c_b and c_a == n or c_a == 0:
	print(-1)
else:
	c_b = c_b + 1
	for i in range(n):
		if a[i] == b[i] and a[i] == 1:
			c_a = c_a - 1
			c_b = c_b - 1
	if c_a == 0:
		print(-1)
	else:
		print(ceil(c_b / c_a))


import sys
inp = sys.stdin.readline

def input():
	return inp().strip()
out = []

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	n = iin()
	r = lin()
	t = lin()
	ans = [0] * n
	for i in range(n):
		if r[i] == t[i] or (r[i] == 0 and t[i] == 1):
			ans[i] = 1
	(sm1, sm2) = (0, 0)
	ch = 0
	for i in range(n):
		if t[i]:
			sm1 += 1
		if r[i]:
			if ans[i]:
				sm2 += 1
			else:
				ch += 1
	if sm1 >= sm2 + ch and ch == 0:
		print(-1)
	else:
		df = sm1 - sm2 + 1
		print((df + ch - 1) // ch)
main()


from sys import stdin, stdout
Pi = lambda x: stdout.write(str(x) + '\n')
S = lambda x: x * (x + 1) // 2
R = lambda : stdin.readline()
Ri = lambda x: map(int, x.split())

def main():
	n = int(R())
	A = list(Ri(R()))
	B = list(Ri(R()))
	a = sum(A)
	b = sum(B)
	ans = 0
	for i in range(n):
		if A[i] and B[i] == 0:
			ans += 1
	if a > b:
		Pi(1)
	elif ans == 0:
		print(-1)
	else:
		i = 1
		a -= ans
		while 1:
			if i * ans + a > b:
				break
			i += 1
		Pi(i)
main()


N = int(input())
robo = list(map(int, input().split()))
bio = list(map(int, input().split()))
points = [0 for i in range(N)]
r_cnt = 0
b_cnt = 0
for i in range(N):
	if robo[i] == 0 and bio[i] == 1:
		b_cnt += 1
	elif robo[i] == 1 and bio[i] == 0:
		r_cnt += 1
if r_cnt == b_cnt + 1 or r_cnt > b_cnt:
	print(1)
elif r_cnt == 0 or b_cnt == 0:
	print(-1)
elif (b_cnt + 1) % r_cnt == 0:
	print(int((b_cnt + 1) / r_cnt))
else:
	print(int((b_cnt + 1) / r_cnt) + 1)


import math
n = int(input())
l1 = input().split()
l2 = input().split()
countdef = 0
for i in range(n):
	if l1[i] == '0' and l2[i] == '1':
		countdef += 1
countb = 0
for i in range(n):
	if l1[i] == '1' and l2[i] == '0':
		countb += 1
if countb == 0:
	print(-1)
else:
	print(math.ceil((countdef + 1) / countb))


t = int(input())
rb1 = input().split()
rb2 = input().split()
ls = []
x1 = 0
x2 = 0
for i in range(t):
	if rb1[i] == '0' and rb2[i] == '1':
		x2 += 1
	if rb1[i] == '1' and rb2[i] == '0':
		x1 += 1
if x1 == 0:
	print(-1)
else:
	print(int(x2 / x1 + 1))


import math

def main():
	t = int(input())
	rc = [int(item) for item in input().split(' ')]
	bs = [int(item) for item in input().split(' ')]
	bs_1 = 0
	bs_1_rc_1 = 0
	rc_1_no_bs = 0
	for i in range(t):
		if rc[i] == 1 and bs[i] == 0:
			rc_1_no_bs += 1
		if bs[i] == 1:
			bs_1 += 1
		if rc[i] == 1 and bs[i] == 1:
			bs_1_rc_1 += 1
	if rc_1_no_bs == 0:
		print('-1')
	else:
		print(f'{int(max(1, math.ceil((bs_1 - bs_1_rc_1 + 1) / rc_1_no_bs)))}')
main()


import math
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
same = 0
for (i, j) in zip(A, B):
	if i == j and i == 1:
		same += 1
A1 = A.count(1)
B1 = B.count(1)
if A1 == 0 or A1 == B1 == same:
	print(-1)
else:
	B1 = B1 - same + 1
	A1 = A1 - same
	if A1 == 0:
		print(-1)
	else:
		print(math.ceil(B1 / A1))


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
c2 = 0
for i in range(n):
	if b[i] == 1 and r[i] == 0:
		count += 1
	elif r[i] == 1 and b[i] == 0:
		c2 += 1
if c2 == 0:
	print(-1)
else:
	print(count // c2 + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x1 = set((i for i in range(n) if a[i]))
x2 = set((i for i in range(n) if b[i]))
x = len(x1.difference(x2))
if x == 0:
	print(-1)
	exit()
s1 = sum(a)
s2 = sum(b)
ms = 1
while s1 <= s2:
	s1 += x
	ms += 1
print(ms)


n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
R = 0
B = 0
i = 0
while i < n:
	if r[i] == 1 and b[i] == 0:
		R += 1
	if r[i] == 0 and b[i] == 1:
		B += 1
	i += 1
if R == 0:
	print('-1')
else:
	print(B // R + 1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
if sum(l1) > sum(l2):
	print(1)
else:
	e = 0
	for i in range(n):
		if l1[i] == 1 and l2[i] == 0:
			e += 1
	if e == 0:
		print(-1)
	else:
		p = sum(l2) + 1 - (sum(l1) - e)
		if p % e == 0:
			print(p // e)
		else:
			print(p // e + 1)


n = int(input())
rlist = list(map(int, input().split()))
blist = list(map(int, input().split()))
count = 0
count2 = 0
for i in range(n):
	if rlist[i] == 1 and blist[i] == 0:
		count += 1
	elif rlist[i] == 0 and blist[i] == 1:
		count2 += 1
if count == 0:
	print(-1)
else:
	count2 += 1
	if count2 % count == 0:
		ans = count2 // count
	else:
		ans = count2 // count + 1
	print(ans)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ka = kb = 0
for i in range(n):
	if a[i] != b[i]:
		if a[i]:
			ka += 1
		else:
			kb += 1
print(-1 if ka == 0 or a == b else kb // ka + 1)


x = input()
rinc = input().split(' ')
bionic = input().split(' ')
no = 0
for i in range(len(rinc)):
	if bionic[i] > rinc[i]:
		no += 1
counter = 0
for i in range(len(rinc)):
	if rinc[i] > bionic[i]:
		counter += 1
if counter != 0:
	sub = int(no / counter)
	print(sub + 1)
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = 0
ab = 0
for i in range(n):
	if a[i] == 1 and b[i] != 1:
		t += 1
	if a[i] == 1 and b[i] == 1:
		ab += 1
if t == 0:
	print(-1)
else:
	print(max(0, sum(b) - ab) // t + 1)


n = int(input())
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
count1 = 0
count2 = 0
for i in range(n):
	if b[i] == 1 and c[i] == 0:
		count1 += 1
	elif b[i] == 0 and c[i] == 1:
		count2 += 1
if count1 == 0:
	print(-1)
else:
	print(count2 // count1 + 1)


import math
n = int(input())
r = input().split(' ')
b = input().split(' ')
top = 0
bottom = 0
for i in range(n):
	if r[i] == '1' and b[i] == '0':
		top += 1
	elif r[i] == '0' and b[i] == '1':
		bottom += 1
diff = top + bottom
if top == 0:
	print(-1)
elif top > bottom:
	print(1)
else:
	temp = round(bottom / top)
	if temp * top <= bottom:
		print(temp + 1)
	else:
		print(temp)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
	print(-1)
else:
	counta = 0
	countb = 0
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			counta += 1
		elif a[i] == 0 and b[i] == 1:
			countb += 1
	if counta == 0:
		print(-1)
	else:
		print(countb // counta + 1)


from math import ceil
n = int(input())
apna = list(map(int, input().split()))
unka = list(map(int, input().split()))
cnt = 0
c = 0
for i in range(n):
	if unka[i] == 1 and apna[i] == 0:
		cnt += 1
	if apna[i] == 1 and unka[i] == 0:
		c += 1
cnt += 1
if cnt > 0 and c == 0:
	print(-1)
else:
	print(ceil(cnt / c))


trials = int(input())
robota = input().split()
robotb = input().split()
battles = []
while trials != 0:
	trials -= 1
	battles.append((int(robota[trials]), int(robotb[trials])))
scorea = 0
scoreb = 0
for i in battles:
	if i[0] + i[1] == 2:
		continue
	elif i[0] + i[1] == 0:
		continue
	elif i[1] == 1:
		scoreb += 1
	elif i[0] == 1:
		scorea += 1
if scorea > scoreb:
	print(1)
if scorea == scoreb:
	if scorea == 0 and scoreb == 0:
		print(-1)
	else:
		print(2)
if scoreb > scorea:
	x = scoreb - scorea
	if scorea == 0:
		print(-1)
	else:
		print(int(x / scorea) + 2)


n = int(input())
r_data = [int(s) for s in input().split(' ')]
b_data = [int(s) for s in input().split(' ')]
r = 0
b = 0
for i in range(n):
	if r_data[i] != b_data[i]:
		r += r_data[i]
		b += b_data[i]
if r == 0:
	print(-1)
elif r > b:
	print(1)
elif r == b:
	print(2)
else:
	print(b // r + 1)


n = int(input())
(cc, ca, cb) = (0, 0, 0)
ans = 1
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for (i, j) in zip(a, b):
	if i == j and i == 1:
		cc += 1
for i in a:
	if i == 1:
		ca += 1
for j in b:
	if j == 1:
		cb += 1
ca -= cc
cb -= cc
if ca == 0:
	print(-1)
else:
	x = 1
	while x * ca <= cb:
		x += 1
		if ca * x > cb:
			ans = x
			break
	print(ans)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = 0
b1 = 0
for i in range(len(a)):
	if a[i] == 1 and b[i] == 0:
		a1 += 1
	if a[i] == 0 and b[i] == 1:
		b1 += 1
	else:
		k = 1
if a1 == 0:
	print('-1')
else:
	tot = a1 + b1
	print(int(tot / a1))


from math import *
n = int(input())
arr = [int(i) for i in input().split()]
brr = [int(i) for i in input().split()]
(a, b, c) = (0, 0, 0)
for i in range(n):
	if arr[i] == 1 and brr[i] == 0:
		c += 1
	a += arr[i]
	b += brr[i]
if c == 0:
	print(-1)
elif a > b:
	print(1)
else:
	print(int(ceil((b + 1 - a) / c)) + 1)


from sys import stdin, stdout
from math import *

def main():
	nbre = int(stdin.readline().strip())
	tablo1 = list(map(int, stdin.readline().strip().split(' ')))
	tablo2 = list(map(int, stdin.readline().strip().split(' ')))
	(nbre1, nbre2) = (0, 0)
	for loop in range(nbre):
		if tablo1[loop] == 1 and tablo2[loop] == 0:
			nbre1 += 1
		if tablo2[loop] == 1 and tablo1[loop] == 0:
			nbre2 += 1
	if nbre1 > nbre2:
		stdout.write('1')
		return
	if nbre1 == 0:
		stdout.write('-1')
		return
	if nbre1 == nbre2:
		stdout.write('2')
		return
	reponse = ceil(nbre2 / nbre1)
	if nbre2 % nbre1 == 0:
		reponse += 1
	stdout.write(str(reponse))
main()


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [1 for x in range(len(a)) if a[x] == 1 and b[x] == 0]
d = [1 for x in range(len(a)) if a[x] == 1 and b[x] == 1]
if len(c) == 0:
	print(-1)
else:
	div = len(c)
	somab = b.count(1) - d.count(1)
	print(math.floor(somab / div) + 1)


t = int(input())
s1 = input().split()
s2 = input().split()
r = 0
b = 0
for i in range(t):
	if int(s1[i]) > int(s2[i]):
		r += 1
	elif int(s1[i]) < int(s2[i]):
		b += 1
if r == 0 and b == 0 or r == 0:
	print('-1')
else:
	re = b // r
	print(re + 1)


n = int(input())
ar1 = list(map(int, input().split()))
ar2 = list(map(int, input().split()))
a = 0
b = 0
for i in range(n):
	if ar1[i] == 1 and ar2[i] == 0:
		a += 1
	if ar1[i] == 0 and ar2[i] == 1:
		b += 1
if a == 0:
	print(-1)
elif a > b:
	print(1)
else:
	k = (b + 1) // a
	if (b + 1) % a != 0:
		k += 1
	print(k)


def Input():
	tem = input().split()
	ans = []
	for it in tem:
		ans.append(int(it))
	return ans
n = Input()[0]
a = Input()
b = Input()
num_A = 0
num_B = 0
for i in range(n):
	if a[i] == b[i]:
		continue
	if a[i] == 1:
		num_A += 1
	else:
		num_B += 1
if num_A == 0:
	print(-1)
else:
	ans = max(num_A, num_B + 1)
	if ans % num_A == 0:
		print(ans // num_A)
	else:
		print(ans // num_A + 1)


def main():
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count_a = 0
	count_b = 0
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			count_a += 1
		elif r[i] == 0 and b[i] == 1:
			count_b += 1
	if count_a != 0:
		print(count_b // count_a + 1)
	else:
		print(-1)
main()


n = int(input())
rci = input().split()
bsi = input().split()
contrci = 0
contbsi = 0
for i in range(n):
	if rci[i] != bsi[i]:
		if rci[i] == '1':
			contrci += 1
		else:
			contbsi += 1
if contrci == 0:
	print('-1')
else:
	print(contbsi // contrci + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
if r.count(0) == n and b.count(0) == n or (r.count(1) == n and b.count(1) == n):
	print(-1)
else:
	i = 0
	while i < n:
		if b[i] == 1 and r[i] == 1:
			del b[i]
			del r[i]
			n -= 1
			i -= 1
		i += 1
	rs = sum(r)
	bs = sum(b)
	if rs == 0:
		print(-1)
	else:
		print(bs // rs + 1)


def linput(a):
	return [int(i) for i in a.split()]
for u in range(1):
	(rb, bb) = (0, 0)
	n = int(input())
	r = linput(input())
	b = linput(input())
	for i in range(n):
		if r[i] == 1 and b[i] != 1:
			rb += 1
		if r[i] != 1 and b[i] == 1:
			bb += 1
	if rb == 0:
		print(-1)
	else:
		print(bb // rb + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [1] * n
d = 0
j = []
if a == b:
	print(-1)
else:
	g = sum(a)
	e = sum(b)
	if g < e:
		for i in range(n):
			if b[i] == 0 and a[i] == 1:
				j.append(i)
				d += 1
		if len(j) > 0:
			g = g - d
			for i in range(len(j)):
				h = (e - g) // d + 1
				a[j[i]] = h
			print(max(a))
		else:
			print(-1)
	elif g == e:
		print(2)
	else:
		print(max(a))


n = int(input())
list_1 = map(int, input().split(' '))
list_2 = list(map(int, input().split(' ')))
first = 0
second = 0
index = 0
for i in list_1:
	if i == 1 and list_2[index] == 0:
		first += 1
	elif i == 0 and list_2[index] == 1:
		second += 1
	index += 1
if first == 0:
	print(-1)
	exit(0)
print(second // first + 1)


from math import ceil
n = int(input())
robo = list(map(int, input().split()))
bio = list(map(int, input().split()))
(cr, cb) = (0, 0)
for i in range(n):
	if robo[i] > bio[i]:
		cr += 1
	if bio[i] > robo[i]:
		cb += 1
cb += 1
if cb > 0 and cr == 0:
	print(-1)
else:
	print(ceil(cb / cr))


x = int(input())
bot1 = input().split()
bot2 = input().split()
totalbot1 = 0
totalbot2 = 0
counter = 0
for i in range(0, x):
	if int(bot1[i]) == int(bot2[i]) and int(bot1[i]) == 1:
		counter += 1
for i in bot1:
	totalbot1 += int(i)
for i in bot2:
	totalbot2 += int(i)
if totalbot1 > totalbot2:
	print(1)
elif totalbot1 == 0:
	print(-1)
elif totalbot1 == counter:
	print(-1)
else:
	botcount1 = 0
	botcount2 = 0
	for i in range(0, x):
		if int(bot1[i]) != int(bot2[i]):
			if int(bot1[i]) > int(bot2[i]):
				botcount1 += 1
			else:
				botcount2 += 1
	if botcount1 == 0:
		botcount1 = 1
	total = int(botcount2 / botcount1 + 1)
	print(total)


from sys import stdin, stdout
from math import ceil
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	n = int(rl())
	R = [int(x) for x in rll()]
	B = [int(x) for x in rll()]
	(rb, bb) = (0, 0)
	ans = -1
	for (r, b) in zip(R, B):
		if r == 1 and b == 0:
			rb += 1
		elif r == 0 and b == 1:
			bb += 1
	if rb != 0:
		ans = ceil((bb + 1) / rb)
	stdout.write(str(ans))
	stdout.write('\n')
	stdout.close()
main()


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_s = sum(a)
b_s = sum(b)
if a_s > b_s:
	print(1)
else:
	f = 1
	for i in range(n):
		if a[i] != b[i]:
			break
	else:
		f = 0
	(ai, bi) = (0, 0)
	for i in range(n):
		if a[i] > b[i]:
			ai += 1
		elif b[i] > a[i]:
			bi += 1
	req_sum = bi + 1
	if ai == 0:
		print(-1)
	elif f:
		print(math.ceil(req_sum / ai))
	else:
		print(-1)


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
n = int(inp())
r = [int(x) for x in inp().split()]
b = [int(x) for x in inp().split()]
cR = 0
cB = 0
for i in range(n):
	if r[i] > b[i]:
		cR += 1
	elif b[i] > r[i]:
		cB += 1
if cR == 0:
	print(-1)
else:
	print(cB // cR + 1)


import math
n = int(input())
x = [int(n) for n in input().split()]
y = [int(n) for n in input().split()]
pl = 0
mi = 0
for i in range(n):
	if x[i] - y[i] > 0:
		pl += 1
	elif x[i] - y[i] < 0:
		mi += 1
if pl == 0:
	print(-1)
elif mi == 0:
	print(1)
elif mi % pl == 0:
	print(math.ceil(mi / pl) + 1)
else:
	print(math.ceil(mi / pl))


hm = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = [0, 0]
for i in range(hm):
	if a[i] > b[i]:
		s[0] += 1
	elif a[i] < b[i]:
		s[1] += 1
if s[0] == 0:
	print(-1)
elif s[1] == 0:
	print(1)
else:
	print(s[1] // s[0] + 1)


N = int(input())
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))
count = 0
x = A.count(1)
y = B.count(1)
if x > y:
	print(1)
else:
	for (i, j) in zip(A, B):
		if i == 1 and j == 0:
			count += 1
	if count == 0:
		print(-1)
	else:
		target = y + 1 - (x - count)
		use = count
		if target % use == 0:
			print(target // use)
		else:
			print(target // use + 1)


n = int(input())
robocode = list(map(int, input().split()))
bionic = list(map(int, input().split()))
l = list(zip(robocode, bionic))
rcount = l.count((1, 0))
biocount = l.count((0, 1))
if rcount > biocount:
	print(1)
elif biocount == n or rcount == 0:
	print(-1)
elif biocount >= rcount:
	print(biocount // rcount + 1)


from sys import stdin, stdout
n = int(stdin.readline().strip())
rc = list(map(int, stdin.readline().strip().split(' ')))
bs = list(map(int, stdin.readline().strip().split(' ')))
rct = 0
bst = 0
for i in range(len(rc)):
	if rc[i] == 1 and bs[i] == 0:
		rct += 1
	elif bs[i] == 1 and rc[i] == 0:
		bst += 1
if rct == 0:
	ans = -1
elif rct > bst:
	ans = 1
elif rct == bst:
	ans = 2
else:
	ans = bst // rct + 1
stdout.write(str(ans) + '\n')


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
s1 = sum(l1)
s2 = sum(l2)
if s1 > s2:
	print(1)
else:
	A = {}
	B = {}
	for i in range(n):
		A[i] = l1[i]
		B[i] = l2[i]
	(count, count1, count2) = (0, 0, 0)
	for i in range(n):
		if A[i] == 0 and B[i] == 1:
			count += 1
		elif A[i] == 1 and B[i] == 0:
			count1 += 1
		elif A[i] == 1 and B[i] == 1:
			count2 += 1
	if count == 0 or count1 == 0:
		print(-1)
	else:
		f = count // count1 + 1
		print(f)


import math
n = int(input())
r = [int(n) for n in input().split()]
b = [int(n) for n in input().split()]
d = sum(r) - sum(b) - 1
big = [r[i] for i in range(n) if r[i] > b[i]]
if d > 0:
	print('1')
elif len(big) == 0:
	print('-1')
else:
	score = sum(big) - d
	print(math.ceil(score / len(big)))


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
import math
x = 0
y = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		y += 1
	if r[i] == 1 and b[i] == 0:
		x += 1
if b.count(1) == n:
	print(-1)
elif r.count(1) > b.count(1):
	print(1)
elif b.count(1) == 0 and r.count(1) == 0:
	print(-1)
else:
	try:
		print(math.ceil((y + 1) / x))
	except ZeroDivisionError:
		print(-1)


n = int(input())
r = input().split()
b = input().split()
if r.count('1') > b.count('1'):
	print(1)
else:
	x = b.count('1') - r.count('1') + 1
	count = 0
	for i in range(n):
		if r[i] == '1' and b[i] == '0':
			count += 1
	if count == 0:
		print(-1)
	elif x % count == 0:
		print(x // count + 1)
	else:
		print(x // count + 1 + 1)


n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
	if A[i] == 1 and B[i] == 0:
		x += 1
	elif A[i] == 0 and B[i] == 1:
		y += 1
import math
if x == 0:
	print(-1)
elif y % x == 0:
	print(y // x + 1)
else:
	print(math.ceil(y / x))


import math
n = int(input())
robo = list(map(int, input().split()))
bio = list(map(int, input().split()))
num_robo = 0
num_bio = 0
for i in range(n):
	if robo[i] == bio[i]:
		continue
	elif robo[i] > bio[i]:
		num_robo += 1
	else:
		num_bio += 1
if num_robo == 0:
	print(-1)
elif num_robo > num_bio:
	print(1)
elif num_robo == num_bio:
	print(2)
else:
	div = math.ceil(num_bio / num_robo)
	if div == num_bio // num_robo:
		print(div + 1)
	else:
		print(div)


import sys
n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
(pa, pb) = (0, 0)
for i in range(n):
	if a[i] == 0 and b[i] == 1:
		pb += 1
	if a[i] == 1 and b[i] == 0:
		pa += 1
if pa == 0:
	print(-1)
else:
	ans = 1 * pb // pa + 1
	print(ans)


import math
length = int(input())
first = list(map(int, input().split()))
second = list(map(int, input().split()))
second_count = sum(second)
first_count = sum(first)
if second_count == len(second):
	print(-1)
else:
	intersection_count = 0
	i = 0
	while i < len(first):
		if first[i] == 1 and second[i] == 1:
			intersection_count += 1
		i += 1
	if intersection_count == first_count:
		print(-1)
		exit()
	first_count -= intersection_count
	second_count -= intersection_count
	result = (second_count + 1) / first_count
	minumum = math.ceil(result)
	print(minumum)


n = int(input())
arr1 = map(int, input().split())
arr2 = map(int, input().split())
re1 = 0
re2 = 0
s = 0
for (i, j) in zip(arr1, arr2):
	s += i
	if i != j:
		if i == 1:
			re1 += 1
		else:
			re2 += 1
if re1 == 0 or s == 0:
	print(-1)
elif re2 == 0:
	print(1)
elif re2 >= re1:
	print(re2 // re1 + 1)
else:
	print(1)


def Robots(n, a, b):
	(x, y) = (0, 0)
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			x += 1
		elif b[i] == 1 and a[i] == 0:
			y += 1
	if x == 0:
		return -1
	else:
		c = y + 1
		if c % x == 0:
			return c // x
		else:
			return c // x + 1
n = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
print(Robots(n, l1, l2))


R = lambda : map(int, input().split())
(n,) = R()
a = input()
b = input()
a_one = 0
b_two = 0
for (i, j) in zip(a, b):
	if i == '1' and i != j:
		a_one += 1
	if j == '1' and i != j:
		b_two += 1
print(b_two // a_one + 1 if a_one else -1)


n = input()
a = map(int, input().split())
b = map(int, input().split())
a1 = 0
b1 = 0
for (x, y) in zip(a, b):
	if x and (not y):
		a1 += 1
	if y and (not x):
		b1 += 1
if not a1:
	print(-1)
else:
	print(b1 // a1 + 1)


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
mod = 1000000007
n = int(input())
a = li()
b = li()
c = 0
d = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		c += 1
	elif a[i] == 0 and b[i] == 1:
		d += 1
k = c
s = 1
if c == 0 and d == 0:
	print(-1)
	exit()
elif c == 0:
	print(-1)
	exit()
while c <= d:
	c += k
	s += 1
print(s)


import os
import sys
from io import BytesIO, IOBase
from functools import reduce

def solution(n, r_arr, b_arr):
	(r1, b1) = (r_arr.count(1), b_arr.count(1))
	if r_arr == b_arr or r1 == 0 or b1 == n:
		print(-1)
		return
	indices = [i for i in range(n) if r_arr[i] == 1]
	mult = [1] * n
	rp = [mult[i] * r_arr[i] for i in range(n)]
	bp = [mult[i] * b_arr[i] for i in range(n)]
	(i, ni) = (0, len(indices))
	while sum(rp) <= sum(bp):
		mult[indices[i]] += 1
		if i + 1 >= ni:
			i = 0
		else:
			i += 1
		rp = [mult[i] * r_arr[i] for i in range(n)]
		bp = [mult[i] * b_arr[i] for i in range(n)]
	print(max(mult))

def main():
	n = r_int()
	r_arr = r_array()
	b_arr = r_array()
	solution(n, r_arr, b_arr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())

def p_array(arr):
	for x in arr:
		print(x, end=' ')
	print()
main()


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	k = li()
	(x, y) = (0, 0)
	for i in range(n):
		if l[i] == 1 and k[i] != 1:
			x += 1
		if k[i] == 1 and l[i] != 1:
			y += 1
	if x == 0:
		pr(-1)
	else:
		pr(math.ceil((y + 1) / x))
for _ in range(1):
	solve()


from sys import stdin
from math import ceil
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
badpts = 0
goodpts = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		goodpts += 1
	elif a[i] == 0 and b[i] == 1:
		badpts += 1
if goodpts == 0:
	print(-1)
else:
	badpts += 1
	print(ceil(badpts / goodpts))


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
n = val()
a1 = li()
b1 = li()
l = 0
for i in range(n):
	l += 1 if a1[i] == 1 and b1[i] != 1 else 0
if sum(a1) > sum(b1):
	print(1)
elif not l:
	print(-1)
else:
	print(math.ceil((sum(b1) - sum(a1) + 1) / l) + 1)


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = 0
e = 0
for i in range(a):
	if b[i] == 0 and c[i] == 1:
		d += 1
	elif b[i] == 1 and c[i] == 0:
		e += 1
if e != 0:
	print(d // e + 1)
else:
	print(-1)


from math import ceil
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
(X, Y) = (0, 0)
for i in range(n):
	if x[i] == 1 and y[i] == 0:
		X += 1
	elif y[i] == 1 and x[i] == 0:
		Y += 1
if X == 0:
	print(-1)
	exit()
print(ceil((Y + 1) / X))


n = int(input())
s = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
c = 0

def fon(s, d, n):
	for i in range(n):
		if s[i] >= 1 and d[i] == 0:
			s[i] += 1
	return s
for i in range(n):
	if s[i] == 1 and d[i] == 0:
		c += 1
if c == 0:
	print(-1)
else:
	while sum(s) <= sum(d):
		fon(s, d, n)
	print(max(s))


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = 0
b1 = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		a1 += 1
	if a[i] == 0 and b[i] == 1:
		b1 += 1
if a1 == 0:
	print('-1')
else:
	print(int(b1 / a1) + 1)


l = int(input())
a = input()
a.replace(' ', '')
b = input()
b.replace(' ', '')
(c_i, val) = (0, 0)
for i in range(len(a)):
	if b[i] == '1' and a[i] == '0':
		c_i += 1
	if b[i] == '0' and a[i] == '1':
		val += 1
if val > c_i:
	print('1')
elif val <= c_i and val != 0:
	if c_i % val == 0:
		print(int(c_i // val) + 1)
	if c_i % val != 0:
		print(int(c_i // val) + 1)
else:
	print('-1')


import math
n = int(input())
r = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
R = 0
B = 0
for (i, j) in zip(r, b):
	if i and (not j):
		R += 1
	elif j and (not i):
		B += 1
if R == 0:
	print(-1)
elif R > B:
	print(1)
else:
	print(math.ceil((B + 1) / R))


import math
n = int(input())
l = list(map(int, input().split()))
m = list(map(int, input().split()))
h = 0
v = 0
for i in range(n):
	if l[i] == 1 and m[i] == 0:
		h += 1
	if m[i] == 1 and l[i] == 0:
		v += 1
if h > v:
	print(1)
elif h == 0:
	print(-1)
else:
	done = math.ceil((v + 1) / h)
	print(done)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cna = 0
cnb = 0
for i in range(n):
	if a[i] == b[i]:
		continue
	else:
		cna += a[i]
		cnb += b[i]
if cna == 0:
	print(-1)
elif cna > cnb:
	print(1)
else:
	d = cnb - cna
	if d == 0:
		print(2)
	else:
		ans = -(-d // cna)
		if d % cna == 0:
			print(ans + 2)
		else:
			print(ans + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
win = 0
loss = 0
for i in range(n):
	if r[i]:
		if b[i] == 0:
			win += 1
	elif b[i]:
		loss += 1
ans = -1
if win > 0:
	if win > loss:
		ans = 1
	elif win <= loss:
		req = loss // win
		ans = req + 1
print(ans)


n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
total1 = sum(arr1)
total2 = sum(arr2)
count = 0
ones = 0
for i in range(len(arr1)):
	if arr1[i] == 1 and arr2[i] == 0:
		count += 1
	elif arr1[i] == 1 and arr2[i] == 1:
		ones += 1
needed = -1
if total1 > total2:
	print(1)
	exit()
if count >= 1 and total1 <= total2:
	total2 = total2 - ones
	needed = total2 // count + 1
print(needed)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
	print(-1)
else:
	count = 0
	count1 = 0
	for i in range(n):
		if a[i] > b[i]:
			count += 1
		elif b[i] > a[i]:
			count1 += 1
	if count != 0:
		print(math.ceil((count1 + 1) / count))
	else:
		print(-1)


n = int(input())
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
s = 0
k = 0
for i in range(n):
	t = c1[i] - c2[i]
	if t == 1:
		k += 1
	elif t == -1:
		s += 1
if s == 0:
	if k > 0:
		print(1)
	else:
		print(-1)
elif k == 0:
	print(-1)
else:
	print(s // k + 1)


import math
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
count1 = 0
count2 = 0
for i in range(n):
	if l1[i] == 1 and l2[i] == 0:
		count1 += 1
	elif l1[i] == 0 and l2[i] == 1:
		count2 += 1
if count1 == 0:
	print('-1')
else:
	print(math.ceil((count2 + 1) / count1))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = [1] * n
(l, r) = (0, 0)
for i in range(n):
	if a[i] and (not b[i]):
		l += 1
	elif not a[i] and b[i]:
		r += 1
if l > r:
	print(1)
else:
	m = r + 1
	ans = -1
	for i in range(1, m + 1):
		if i * l > r:
			ans = i
			break
	print(ans)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
val_1 = 0
more_val = 0
for i in range(n):
	if l1[i] == 0 and l2[i] == 1:
		val_1 += 1
	elif l1[i] == 1 and l2[i] == 0:
		more_val += 1
if more_val == 0 and val_1 == 0:
	print(-1)
	exit()
if more_val == 0:
	print(-1)
	exit()
if val_1 == 0:
	print(1)
	exit()
print(val_1 // more_val + 1)


from math import ceil

def compute_upper_bound(robot1, robot2):
	first = 0
	second = 0
	for el in zip(robot1, robot2):
		if el[0] == 1 and el[1] == 0:
			first += 1
		elif el[0] == 0 and el[1] == 1:
			second += 1
	if first == 0:
		return -1
	if first > second:
		return 1
	else:
		return ceil((max(second, first) + 1) / first)
t = int(input())
robot1 = list(map(lambda x: int(x), input().split()))
robot2 = list(map(lambda x: int(x), input().split()))
res = compute_upper_bound(robot1, robot2)
print(res)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
u = v = 0
for (x, y) in zip(a, b):
	if x > y:
		u += 1
	elif x < y:
		v += 1
if u == 0:
	print(-1)
else:
	print(v // u + 1)


n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
works = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		works += 1
if not works:
	print(-1)
else:
	sr = sum(r)
	br = sum(b)
	if sr > br:
		print(1)
	else:
		diff = br - sr
		diff += 1
		if diff % works == 0:
			print(1 + diff // works)
		else:
			print(diff // works + 2)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b_win = 0
chance = 0
for i in range(n):
	if a[i] == 0 and b[i] == 1:
		b_win += 1
	elif a[i] == 1 and b[i] == 0:
		chance += 1
if chance == 0:
	print(-1)
else:
	print(b_win // chance + 1)


from math import ceil
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
a = []
s1 = 0
s2 = 0
for i in range(len(r)):
	if (r[i] == 0) & (b[i] != 0):
		s2 += 1
	elif (r[i] != 0) & (b[i] == 0):
		a.append(i)
	else:
		s1 += 1
		s2 += 1
if len(a) != 0:
	print(ceil((s2 - s1 + 1) / len(a)))
else:
	print(-1)


import math
n = int(input())
r = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
dffa = 0
dffb = 0
for (a, z) in zip(r, b):
	if a == 1 and z == 1 or (a == 0 and z == 0):
		continue
	if a == 1:
		dffa += 1
		continue
	if z == 1:
		dffb += 1
		continue
if dffa == 0:
	print(-1)
	exit(0)
print(math.ceil((dffb + 1) / dffa))


n = int(input())
r = input().split(' ')
r = list(map(int, r))
b = input().split(' ')
b = list(map(int, b))
count = 0
for j in range(n):
	if r[j] == 1 and b[j] == 1:
		count += 1
y = r.count(1)
num1 = y - count
z = b.count(1)
num2 = z - count
if r == b or num1 == 0:
	print(-1)
else:
	ans = num2 // num1 + 1
	print(ans)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
nr = nb = 0
for i in range(n):
	if r[i] and (not b[i]):
		nr += 1
	elif not r[i] and b[i]:
		nb += 1
if not nr:
	print(-1)
	exit()
ret = 1
while nr * ret <= nb:
	ret += 1
print(ret)


n = int(input())
list1 = [int(num) for num in input().split()]
list2 = [int(num) for num in input().split()]
cc = 0
robo = 0
bio = 0
for i in range(0, len(list1)):
	if list1[i] == 1:
		robo += 1
		if list1[i] == 1 and list2[i] != 1:
			cc += 1
	if list2[i] == 1:
		bio += 1
if cc == 0:
	print(-1)
elif robo > bio:
	print(1)
else:
	robo = robo - cc
	diff = bio - robo + 1
	if diff % cc == 0:
		max1 = diff // cc
	else:
		max1 = diff // cc + 1
	print(max1)


n = int(input())
p = [1 for i in range(n)]
lst1 = list()
lst2 = list()
lst1 = input()
lst1 = lst1.split(' ')
lst1 = [int(i) for i in lst1]
lst2 = input()
lst2 = lst2.split(' ')
lst2 = [int(i) for i in lst2]
if all((i == 1 for i in lst1)) & all((i == 1 for i in lst2)):
	print(-1)
elif all((i == 0 for i in lst1)) & all((i == 0 for i in lst2)):
	print(-1)
elif sum(lst1) > sum(lst2):
	print(1)
else:
	only_solved_by_Robo = 0
	only_solved_by_Bionic = 0
	for i in range(n):
		if (lst1[i] == 1) & (lst2[i] == 0):
			only_solved_by_Robo = only_solved_by_Robo + 1
		elif (lst1[i] == 0) & (lst2[i] == 1):
			only_solved_by_Bionic = only_solved_by_Bionic + 1
	if only_solved_by_Robo > 0:
		temp = only_solved_by_Bionic / only_solved_by_Robo
		print(int(temp + 1))
	else:
		print(-1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
a = 0
c = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		a += 1
	elif r[i] == 1 and b[i] == 0:
		c += 1
if c == 0:
	print(-1)
elif c > a:
	print(1)
else:
	print((a + c) // c)


input()
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
flag = len(list(filter(lambda x: As[x] > Bs[x], range(len(As)))))
print((sum(Bs) - sum(As)) // flag + 2 if flag != 0 else -1)


n = int(input())
r1 = list(map(int, input().split()))
r2 = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
for i in range(n):
	if r1[i] == 1 and r2[i] == 0:
		cnt1 += 1
	if r2[i] == 1 and r1[i] == 0:
		cnt2 += 1
if cnt1 == 0:
	print(-1)
	exit()
else:
	print(cnt2 // cnt1 + 1)


n = int(input())
arr1 = [int(x) for x in input().split()]
arr2 = [int(x) for x in input().split()]
(mine, his) = (0, 0)
for x in range(n):
	if arr1[x] > arr2[x]:
		mine += 1
	if arr1[x] < arr2[x]:
		his += 1
if mine:
	for x in range(1, 110):
		if mine * x > his:
			print(x)
			break
else:
	print(-1)


n = int(input())
c = list(map(int, input().split()))
d = list(map(int, input().split()))
count = 0
if 1 not in c and 1 not in d:
	print(-1)
elif 0 not in c and 0 not in d:
	print(-1)
elif 1 not in c:
	print(-1)
elif 1 not in d:
	print(1)
else:
	a = 0
	b = 0
	for i in range(len(c)):
		if c[i] == 1 and d[i] == 0:
			a = a + 1
		if c[i] == 0 and d[i] == 1:
			b = b + 1
	if a > b:
		print(1)
	elif a == 0 and b == 0:
		print(-1)
	elif a != 0:
		print(int(b / a) + 1)
	else:
		print(-1)


from math import ceil

def make_A_win(a, b):
	n = len(a)
	only_a_win = 0
	a_point = 0
	b_point = 0
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			only_a_win += 1
		elif a[i] == 1 and b[i] == 1:
			a_point += 1
			b_point += 1
		elif a[i] == 0 and b[i] == 1:
			b_point += 1
		else:
			continue
	if a_point > b_point:
		return 1
	if only_a_win == 0:
		return -1
	else:
		return ceil((b_point + 1 - a_point) / only_a_win)

def read_line():
	num_probs = int(input())
	a_point = input().split()
	a_point = [int(ch) for ch in a_point]
	b_point = input().split()
	b_point = [int(ch) for ch in b_point]
	print(make_A_win(a_point, b_point))
read_line()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
from math import ceil, floor, log, sqrt, factorial
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def s(a):
	while a >= 10:
		x = 0
		while a:
			x += a % 10
			a //= 10
		a = x
	return a

def main():
	n = ii()
	a = li()
	b = li()
	x = sum(a)
	y = sum(b)
	f = 0
	cnt = 0
	for i in range(n):
		if a[i] != b[i] and a[i] == 1:
			f = 1
			cnt += 1
	if f == 0:
		print(-1)
	elif x > y:
		print(1)
	else:
		m = abs(x - y - 1)
		print(ceil(m / cnt) + 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
r1 = list(map(int, input().split()))
r2 = list(map(int, input().split()))
one_zero = 0
zero_one = 0
for num in range(t):
	if r1[num] == 1 and r2[num] == 0:
		one_zero += 1
	elif r1[num] == 0 and r2[num] == 1:
		zero_one += 1
if one_zero == 0:
	print(-1)
elif one_zero > zero_one:
	print(1)
elif one_zero == zero_one:
	print(2)
else:
	print(int(zero_one / one_zero) + 1)


from sys import stdin
x = int(stdin.readline().strip())
a = stdin.readline().strip().split()
b = stdin.readline().strip().split()
n = 0
pdif = 0
for i in range(0, x):
	if a[i] < b[i]:
		pdif += 1
	elif a[i] > b[i]:
		n += 1
if n == 0:
	print(-1)
else:
	print(int(pdif / n) + 1)


n = int(input())
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
m = [0] * n
zvm = n
tvm = 0
for i in range(n):
	if a[i] == b[i]:
		m[i] = 1
		zvm -= 1
	elif a[i] == 0:
		m[i] = 2
		tvm += 1
		zvm -= 1
if zvm == 0:
	print(-1)
else:
	tvm += 1
	if tvm % zvm == 0:
		print(tvm // zvm)
	else:
		print(tvm // zvm + 1)


t = 1
while t:
	t -= 1
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(rw, bw) = (0, 0)
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			rw += 1
		if r[i] == 0 and b[i] == 1:
			bw += 1
	if rw > bw:
		print(1)
	elif rw == 0:
		print(-1)
	else:
		ans = bw // rw
		print(1 + ans)


from math import ceil
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rWin = 0
bWin = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		rWin += 1
	elif r[i] == 0 and b[i] == 1:
		bWin += 1
if rWin == 0:
	print(-1)
elif rWin > bWin:
	print(1)
elif bWin % rWin == 0:
	print(bWin // rWin + 1)
else:
	print(int(ceil(bWin / rWin)))


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
(p1, p2, j) = ([], [], 1)
for i in range(n):
	if l1[i] ^ l2[i]:
		p1.append(l1[i])
		p2.append(l2[i])
if len(p1) == 0 or (len(set(p1)) == 1 and p1[0] == 0):
	print(-1)
else:
	while True:
		if p1.count(1) * j > p2.count(1):
			break
		j += 1
	print(j)


import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans1 = 0
ans2 = 0
for i in range(n):
	if a[i] != b[i]:
		if a[i] == 1:
			ans1 += 1
		else:
			ans2 += 1
if ans1 == ans2 == 0:
	print(-1)
elif ans1 > ans2:
	print(1)
elif ans1 == 0:
	print(-1)
else:
	c = ans2 // ans1
	if c * ans1 > ans2:
		print(c)
	else:
		print(c + 1)


from math import ceil
n = int(input())
rob1 = list(map(int, input().split()))
rob2 = list(map(int, input().split()))
more = 0
less = 0
for tp in zip(rob1, rob2):
	more += tp[0] > tp[1]
	less += tp[0] < tp[1]
if more == 0:
	print(-1)
elif less == 0:
	print(1)
else:
	print(less // more + 1)


import math
n = int(input())
ri = list(map(int, input().split()))
bi = list(map(int, input().split()))
up = 0
down = 0
mid = 0
if ri == bi:
	print(-1)
else:
	for i in range(n):
		if ri[i] == 0 and bi[i] == 1:
			down += 1
		if ri[i] == 1 and bi[i] == 0:
			up += 1
		if ri[i] == 1 and bi[i] == 1:
			mid += 1
	if up == 0:
		print(-1)
	elif down == 0:
		print(1)
	else:
		print(math.floor((down + up) / up))


n = int(input())
lst1 = [int(i) for i in input().split()]
lst2 = [int(i) for i in input().split()]
i = 0
sum1 = 0
sum2 = 0
s1 = sum(lst1)
s2 = sum(lst2)
while i < n:
	if lst1[i] == 1 and lst2[i] == 0:
		sum1 += 1
	elif lst1[i] == 1 and lst2[i] == 1:
		sum2 += 1
	i += 1
s1 = s1 - sum1
s2 = s2 - sum2
if sum1 == 0:
	print(-1)
else:
	print(s2 // sum1 + 1)


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
r_diff = 0
b_diff = 0
same = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		r_diff += 1
	elif r[i] == 0 and b[i] == 1:
		b_diff += 1
	elif r[i] == 1 and b[i] == 1:
		same += 1
if r_diff > b_diff:
	print(1)
elif r_diff == 0:
	print(-1)
elif b_diff >= r_diff:
	print(math.ceil((b_diff + 1) / r_diff))


from math import ceil
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
foo = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		foo += 1
if foo == 0:
	print(-1)
	exit()
rr = sum(r)
bb = sum(b)
rr -= foo
t = bb - rr
print(ceil((t + 1) / foo))


x = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sm1 = sum(a)
sm2 = sum(b)
if sm1 > sm2:
	print(1)
	exit(0)
req = sm2 + 1 - sm1 + 1
cal = 0
for n in range(x):
	if a[n] > b[n]:
		cal += 1
if cal == 0:
	print(-1)
	exit(0)
from math import ceil
res = ceil(req / cal)
if res * cal + (sm1 - cal) > sm2:
	print(res)
else:
	print(res + 1)


def score(a, b, n):
	aSolve = 0
	bSolve = 0
	impossible = 0
	for i in range(0, n):
		if a[i] > b[i]:
			aSolve += 1
		elif a[i] < b[i]:
			bSolve += 1
		else:
			impossible += 1
	if impossible == n:
		print(-1)
	elif aSolve == 0 and bSolve > 0:
		print(-1)
	elif aSolve > bSolve:
		print(1)
	else:
		x = bSolve + 1
		y = x / aSolve
		if y % 1 == 0:
			print(int(y))
		else:
			print(int(y) + 1)
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
score(a, b, n)


n = int(input())
a = input().split()
b = input().split()
aC = 0
bC = 0
for i in range(n):
	if a[i] == '1' and b[i] == '0':
		aC += 1
	if a[i] == '0' and b[i] == '1':
		bC += 1
if aC == 0:
	print(-1)
elif bC == 0:
	print(1)
else:
	print(bC // aC + 1)


times = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
for x in range(times):
	if a[x] == b[x]:
		a[x] = 0
		b[x] = 0
if a == b or a.count(1) == 0:
	print(-1)
else:
	print(b.count(1) // a.count(1) + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
sb = sum(b)
sr = sum(r)
s = -1
f = 0
c = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		c += 1
	elif r[i] == 0 and b[i] == 1:
		f += 1
if c == 0:
	print(-1)
else:
	print((c + f) // c)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
com = 0
ae = 0
be = 0
for i in range(n):
	if a[i] == 1 and b[i] == 1:
		com += 1
	elif a[i] == 1:
		ae += 1
	elif b[i] == 1:
		be += 1
if com == n or (com == 0 and ae == 0 and (be == 0)):
	print(-1)
elif ae > be:
	print(1)
elif ae > 0:
	print(be // ae + 1)
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
diff = 0
comm = 0
cn1 = a.count(1)
cn2 = b.count(1)
for i in range(len(a)):
	if a[i] == b[i] == 1:
		comm += 1
	if a[i] != b[i]:
		diff += 1
if diff == 0:
	print(-1)
elif cn1 > cn2:
	print(1)
else:
	diff = 0
	for i in range(len(a)):
		if a[i] == 1 and b[i] == 0:
			diff += 1
	cn2 = cn2 - comm
	try:
		print(cn2 // diff + 1)
	except:
		print(-1)


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
t = ii()
r = iia()
b = iia()
if r == b:
	print(-1)
else:
	x1 = r.count(1)
	x2 = b.count(1)
	y = 0
	for i in range(t):
		if r[i] == 1 and b[i] == 1:
			y += 1
	x1 -= y
	x2 -= y
	if x1 == 0:
		print(-1)
	else:
		print(ceil((x2 + 1) / x1))


import math
n = int(input())
l = list(map(int, input().split()))
y = list(map(int, input().split()))
c = 0
d = 0
for i in range(len(l)):
	if l[i] > y[i]:
		c = c + 1
	elif l[i] < y[i]:
		d = d + 1
if c == 0:
	print(-1)
elif d > c:
	if d / c % 1 == 0:
		print(int(d / c + 1))
	else:
		print(int(d // c + 1))
elif d < c:
	print(1)
elif d == c:
	print(2)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
better = 0
score = 0
for i in range(n):
	if r[i] > b[i]:
		better += 1
		score -= 1
	if b[i] > r[i]:
		score += 1
if score < 0:
	print(1)
elif better > 0:
	sol = 0
	if (score + 1) % better == 0:
		sol = (score + 1) / better
	else:
		sol = (score + 1) // better
		sol += 1
	sol += 1
	sol = int(sol)
	print(sol)
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
acnt = 0
bcnt = 0
for i in range(n):
	if a[i] == b[i]:
		continue
	elif a[i] > b[i]:
		acnt += 1
	elif a[i] < b[i]:
		bcnt += 1
if acnt == 0:
	print(-1)
else:
	print((acnt + bcnt) // acnt)


n = int(input())
r = [int(x) for x in input().split()]
s = [int(x) for x in input().split()]
a = 0
b = 0
for i in range(n):
	if r[i] == 1 and s[i] == 0:
		a += 1
	if r[i] == 0 and s[i] == 1:
		b += 1
if a == 0:
	print(-1)
else:
	print(b // a + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b or list(dict.fromkeys(a)) == [0]:
	print(-1)
else:
	dif = 1
	ans = 0
	for i in range(n):
		if b[i] == 1 and a[i] == 0:
			ans += 1
		if a[i] == 1 and b[i] == 0:
			dif += 1
	if dif == 1:
		print(-1)
	else:
		dif -= 1
		print(ans // dif + 1)


import sys
import math
input = sys.stdin.readline
n = int(input())
x1 = [int(_) for _ in input().split()]
x2 = [int(_) for _ in input().split()]
s1 = sum(x1)
s2 = sum(x2)
s3 = 0
for i in range(n):
	if x1[i] == 1 and x2[i] == 1:
		s3 += 1
if s1 == s3:
	print(-1)
else:
	x = math.ceil((s2 - s3) / (s1 - s3))
	if x * (s1 - s3) == s2 - s3:
		print(x + 1)
	else:
		print(x)


def do():
	n = int(input())
	data = list(map(int, input().split()))
	datb = list(map(int, input().split()))
	loseres = 0
	wincnt = 0
	for i in range(n):
		if data[i] > datb[i]:
			wincnt += 1
		elif data[i] == datb[i]:
			continue
		else:
			loseres += 1
	if wincnt == 0:
		print(-1)
		return
	import math
	needpoint = loseres + 1
	print(math.ceil(needpoint / wincnt))
do()


import math
I = input
I()
ar = zip(list(map(int, I().split())), list(map(int, I().split())))
win = los = 0
for x in ar:
	if x[0] & (not x[1]):
		win += 1
	elif (not x[0]) & x[1]:
		los += 1
if win == 0:
	print(-1)
else:
	print(math.ceil((los + 1) / win))


n = int(input())
coder_results = list(map(int, input().split(' ')))
bionic_results = list(map(int, input().split(' ')))
coder_counter = bionic_counter = 0
for i in range(n):
	if coder_results[i] == 1 and bionic_results[i] == 0:
		coder_counter += 1
	if bionic_results[i] == 1 and coder_results[i] == 0:
		bionic_counter += 1
if coder_counter == 0:
	print(-1)
else:
	for i in range(1, 101):
		if i * coder_counter > bionic_counter:
			print(i)
			break


import sys
input = sys.stdin.readline
n = int(input())
x = [*map(int, input().split())]
y = [*map(int, input().split())]
score = [1] * n
(a, b) = (0, 0)
for (i, j) in zip(x, y):
	if i > j:
		a += 1
	elif i < j:
		b += 1
if a == 0:
	print(-1)
	quit()
ans = (b + a) // a
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
am = 0
baal = 0
for i in range(n):
	if a[i] > b[i]:
		am += 1
	elif a[i] < b[i]:
		baal += 1
if am == 0:
	print(-1)
else:
	print(baal // am + 1)


import math

def find_minmax_p(r, b):
	wins = [rr == 1 and bb == 0 for (rr, bb) in zip(r, b)]
	losses = [rr == 0 and bb == 1 for (rr, bb) in zip(r, b)]
	n_wins = sum(wins)
	n_losses = sum(losses)
	if n_wins == 0:
		return -1
	if n_losses == 0:
		return 1
	return math.ceil((n_losses + 1) / n_wins)
n = int(input())
r = [int(s) for s in input().split(' ')]
b = [int(s) for s in input().split(' ')]
assert len(r) == n and len(b) == n
result = find_minmax_p(r, b)
print(result)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
t = 1
while sum(a) <= sum(b):
	for i in range(n):
		if a[i] > 0 and b[i] == 0:
			a[i] = a[i] + 1
			t = a[i]
		if a[i] == b[i] or a[i] < b[i]:
			c = c + 1
	if c == n:
		break
if c == n:
	print('-1')
else:
	print(t)


n = int(input())
a = str(input())
b = str(input())
a = a.split(' ')
b = b.split(' ')
k = 0
d = 0
for i in range(n):
	if a[i] != b[i]:
		if a[i] == '1':
			d += 1
		elif b[i] == '1':
			k += 1
if d == 0:
	print(-1)
elif k == 0:
	print(1)
else:
	p = k // d + 1
	print(p)


def robots(t, r, b):
	if r == b or sum(r) == 0:
		return -1
	else:
		x = 0
		y = 0
		for i in range(t):
			if r[i] > b[i]:
				x += 1
			elif r[i] < b[i]:
				y += 1
		if x == 0:
			return -1
		else:
			return (y + 1) // x + bool((y + 1) % x)
t = int(input())
q = list(map(int, input().split()))
s = list(map(int, input().split()))
print(robots(t, q, s))


from math import ceil
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = 0
m = 0
for i in range(n):
	d = a[i] - b[i]
	if d > 0:
		p += d
	else:
		m -= d
if p == 0:
	print(-1)
else:
	print(m // p + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
f = 0
s = 0
for i in range(n):
	if r[i] > b[i]:
		f += 1
	elif r[i] < b[i]:
		s += 1
if f == 0:
	print(-1)
else:
	print((s + f) // f)


t = int(input())
r = []
b = []
r = list(map(int, input().split()))
b = list(map(int, input().split()))
flag = 0
rr = 0
bb = 0
same = 0
for i in range(len(r)):
	if r[i] != b[i]:
		flag += 1
	if r[i] > b[i]:
		rr += 1
	if r[i] < b[i]:
		bb += 1
	if r[i] == b[i]:
		same += 1
if flag == 0 or rr == 0:
	print(-1)
else:
	print(int((rr + bb) // rr))


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
lose = 0
win = 0
eps = 1e-07
for i in range(n):
	if r[i] > b[i]:
		win += 1
	elif r[i] < b[i]:
		lose += 1
if win == 0:
	print(-1)
else:
	print(math.ceil((lose + eps) / win))


count = int(input())
robo = list(map(int, input().split()))
bionic = list(map(int, input().split()))
robo_score = 0
bionic_score = 0
for i in range(count):
	if robo[i] == 0 and bionic[i] == 1:
		bionic_score = bionic_score + 1
	if robo[i] == 1 and bionic[i] == 0:
		robo_score = robo_score + 1
if robo_score == 0:
	print(-1)
else:
	print(bionic_score // robo_score + 1)


import math
n = int(input())
robot1 = list(map(int, input().split()))
robot2 = list(map(int, input().split()))
sum_r1 = sum(robot1)
sum_r2 = sum(robot2)
if robot1 == robot2:
	print(-1)
else:
	for (i, j) in zip(robot1, robot2):
		if i == j == 1:
			sum_r1 -= 1
			sum_r2 -= 1
	if sum_r1 == 0:
		print(-1)
	elif (sum_r2 / sum_r1).is_integer():
		print(math.ceil(sum_r2 / sum_r1) + 1)
	else:
		print(math.ceil(sum_r2 / sum_r1))


n = int(input(''))
A = list(input('').split(' '))
B = list(input('').split(' '))
for i in range(n):
	A[i] = int(A[i])
	B[i] = int(B[i])
val = -1
for i in range(1, n + 1):
	found = False
	scoreA = 0
	scoreB = 0
	for j in range(n):
		if A[j] != B[j]:
			scoreA += i * A[j]
			scoreB += 1 * B[j]
	if scoreA > scoreB:
		found = True
		val = i
		break
print(val)


n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
r_score = 0
b_score = 0
if r.count(1) > b.count(1) and r.count(1) - b.count(1) >= 1:
	print(1)
elif len(set(r)) == len(set(b)) == 1:
	print(-1)
else:
	for i in range(n):
		if r[i] == 1 and b[i] == 0:
			r_score += 1
		elif r[i] == 1 and b[i] == 1:
			pass
		elif r[i] == 0 and b[i] == 1:
			b_score += 1
	if r_score == 0:
		print(-1)
	else:
		print(b_score // r_score + 1)


from math import floor

def solve(r, b):
	diffs = [a - c for (a, c) in zip(r, b)]
	n_positive = len([x for x in diffs if x > 0])
	n_negative = len([x for x in diffs if x < 0])
	if n_positive == 0:
		return -1
	if n_negative == n_positive:
		return 2
	if n_positive > n_negative:
		return 1
	div = floor((n_negative + 1) / n_positive)
	rest = n_negative + 1 - n_positive * div
	if rest > 0:
		return div + 1
	return div
n = int(input())
r = [int(s) for s in input().split(' ')]
b = [int(s) for s in input().split(' ')]
print(solve(r, b))


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		x += 1
	if b[i] == 1 and r[i] == 0:
		y += 1
if x == 0:
	print('-1')
else:
	x1 = (y + 1) / x
	print(math.ceil(x1))


printn = lambda x: print(x, end='')
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
n = inn()
r = inl()
b = inl()
rw = bw = 0
for i in range(n):
	if r[i] > b[i]:
		rw += 1
	elif r[i] < b[i]:
		bw += 1
if rw == 0:
	print(-1)
else:
	print((rw + bw) // rw)


a = int(input())
r1 = list(map(int, input().split()))
r2 = list(map(int, input().split()))
flag = 0
for i in range(a):
	if r1[i] != r2[i]:
		flag = 1
		break
if flag == 0 or r1.count(0) == len(r1):
	print(-1)
else:
	cr = 0
	ctr = 0
	for i in range(a):
		if r1[i] < r2[i]:
			cr += 1
		elif r1[i] == r2[i]:
			cr += 0
		else:
			ctr += 1
	if ctr > cr:
		print(1)
	elif ctr == 0:
		print(-1)
	else:
		t = cr // ctr
		print(t + 1)


n = int(input())
r1 = [*map(int, input().split())]
r2 = [*map(int, input().split())]
if r1 == r2:
	print(-1)
else:
	cnt = 0
	for i in range(n):
		if r1[i] == r2[i] and r1[i] == 1:
			cnt += 1
	if cnt == sum(r1):
		print(-1)
		exit(0)
	while sum(r1) <= sum(r2):
		for i in range(n):
			if r1[i] != r2[i] and r1[i] != 0:
				r1[i] += 1
	print(max(r1))


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
b_r = 0
sp = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		b_r += 1
	elif r[i] == 1 and b[i] == 0:
		sp += 1
if sp == 0:
	print(-1)
elif sp > b_r:
	print(1)
else:
	print(1 + b_r // sp)


import math
n = int(input())
w = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
a = b = 0
for i in range(n):
	if w[i] == 1 and l[i] == 0:
		a += 1
	elif w[i] == 0 and l[i] == 1:
		b += 1
if a == 0:
	print(-1)
else:
	print(math.ceil((b + 1) / a))


import math
n = int(input())
r = [int(ele) for ele in input().split()]
b = [int(ele) for ele in input().split()]
count_r = 0
count_b = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		count_r += 1
	elif b[i] == 1 and r[i] == 0:
		count_b += 1
if count_r == 0 and count_b == 0 or count_r == 0:
	print(-1)
elif count_r > count_b:
	print(1)
elif count_r == count_b:
	print(2)
else:
	print(math.floor(count_b / count_r) + 1)


import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda : list(map(int, input().split()))

def printARR(arr):
	for e in arr:
		print(e, end=' ')
	print()

def main():
	n = I()
	r = ARR()
	b = ARR()
	min_scr_b = 0
	task_r = 0
	for i in range(n):
		if not r[i] ^ b[i]:
			continue
		if b[i]:
			min_scr_b += 1
		elif r[i]:
			task_r += 1
	if task_r == 0:
		print(-1)
	else:
		print(mt.ceil((min_scr_b + 1) / task_r))
tc = 1
for _ in range(tc):
	main()


import math
tests = int(input())
(a, b) = (0, 0)
A = input().split()
B = input().split()
for (a_i, b_i) in zip(A, B):
	if a_i == '1' and b_i == '0':
		a += 1
	elif a_i == '0' and b_i == '1':
		b += 1
if a == 0:
	print(-1)
else:
	print(int(math.floor(b / a + 1)))


from math import ceil, floor, sqrt
n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
(c1, c2) = (0, 0)
cnt = l1.count(1)
for i in range(n):
	if l1[i] == 1 and l2[i] == 0:
		c1 += 1
	elif l1[i] == 0 and l2[i] == 1:
		c2 += 1
if c1 == c2 == 0 or cnt == 0:
	print(-1)
elif c1 > c2:
	print(1)
elif c1 == c2 > 0:
	print(2)
elif c1 < c2:
	if c1 == 0:
		print(-1)
	else:
		x = c2 / c1
		if x - int(x) == 0:
			print(int(x) + 1)
		else:
			print(ceil(x))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_t = b_t = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		a_t += 1
	elif a[i] == 0 and b[i] == 1:
		b_t += 1
if a_t == 0:
	print(-1)
else:
	print(b_t // a_t + 1)


import math
n = int(input())
r = [int(s) for s in input().split(' ')]
b = [int(s) for s in input().split(' ')]
r_only = 0
b_only = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		r_only += 1
	elif b[i] == 1 and r[i] == 0:
		b_only += 1
if r_only == 0:
	print(-1)
elif r_only > b_only:
	print(1)
else:
	print(math.ceil((b_only + 1) / r_only))


from math import ceil

def solve(r, b):
	(x, y) = (0, 0)
	for (rr, bb) in zip(r, b):
		if rr == bb:
			continue
		if rr:
			x += 1
		else:
			y += 1
	if x:
		return int(ceil(float(y + 1) / x))
	return -1
N = int(input())
r = map(int, input().split())
b = map(int, input().split())
print(solve(r, b))


import math
t = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
r1 = 0
b1 = 0
for i in range(t):
	if r[i] != b[i]:
		if r[i] == 1:
			r1 += 1
		else:
			b1 += 1
if r1 == 0:
	print(-1)
elif b1 % r1 == 0:
	print(b1 // r1 + 1)
else:
	print(math.ceil(b1 / r1))


n = int(input())
r = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c1 = 0
c2 = 0
for i in range(n):
	if r[i] == 0 and b[i] == 1:
		c2 += 1
	elif r[i] == 1 and b[i] == 0:
		c1 += 1
if c1 == 0:
	print(-1)
elif c1 > c2:
	print('1')
else:
	d = c2 + 1
	ab = int(d / c1)
	rem = d % c1
	if rem == 0:
		print(ab)
	else:
		print(ab + 1)


def solve():
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(x, y, z) = (0, 0, 0)
	for i in range(n):
		if r[i] > 0 and b[i] > 0:
			x += 1
		elif r[i] > 0:
			y += 1
		elif b[i] > 0:
			z += 1
	if y == 0:
		print(-1)
		return
	print(z // y + 1)
t = 1
for i in range(t):
	solve()


import sys

def main():
	n = int(sys.stdin.readline())
	p = [int(y) for y in sys.stdin.readline().split()]
	q = [int(y) for y in sys.stdin.readline().split()]
	win = 0
	loss = 0
	for i in range(n):
		if p[i] != q[i]:
			if p[i] == 0:
				loss += 1
			else:
				win += 1
	if win == 0:
		print(-1)
	else:
		ans = loss // win
		print(ans + 1)
main()


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
cb = 0
cr = 0
for i in range(n):
	if b[i] == 1 and r[i] == 0:
		cb += 1
	if b[i] == 0 and r[i] == 1:
		cr += 1
if cb == 0 and cr == 0 or cr == 0:
	print(-1)
elif cb == cr:
	print(2)
else:
	print(cb // cr + 1)


def ques3(a, b):
	counta = 0
	countb = 0
	for i in range(len(a)):
		if a[i] > b[i]:
			counta += 1
		elif a[i] < b[i]:
			countb += 1
	if counta == 0:
		print(-1)
	else:
		print(countb // counta + 1)
t = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = ques3(a, b)
ans


from math import *
n = int(input())
s1 = []
s2 = []
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
c01 = 0
c10 = 0
for i in range(n):
	if s1[i] == 0 and s2[i] == 1:
		c01 += 1
	elif s2[i] == 0 and s1[i] == 1:
		c10 += 1
if c10 == 0:
	ans = -1
else:
	ans = max(1, ceil((c01 + 1) / c10))
print(ans)


def f():
	n = int(input())
	li1 = list(map(int, input().split()))
	li2 = list(map(int, input().split()))
	li1_power = 0
	li2_power = 0
	for i in range(n):
		if li1[i] > li2[i]:
			li1_power += 1
		if li1[i] < li2[i]:
			li2_power += 1
	if li1_power == 0:
		print('-1')
	else:
		print(li2_power // li1_power + 1)
f()


import sys
input = sys.stdin.readline
n = int(input())
r = input().split()
b = input().split()
(c, d) = (0, 0)
for i in range(n):
	if r[i] == '1' and b[i] == '0':
		c += 1
	elif r[i] == '0' and b[i] == '1':
		d += 1
print(-1 if c == 0 else 1 if c > d else d // c + 1)


n = int(input())
robo = input().split()
bio = input().split()
robo = [int(i) for i in robo]
bio = [int(i) for i in bio]
for i in range(n):
	if robo[i] == bio[i]:
		robo[i] = 0
		bio[i] = 0
maxno = sum(bio)
t = 0
for i in range(n):
	if robo[i] == 1:
		t += 1
if t == 0:
	print(-1)
else:
	minmax = maxno / t
	if maxno == 0:
		print(1)
	elif type(minmax) == int:
		print(minmax)
	else:
		print(int(minmax) + 1)


(n, roboAdvantage, bionicAdvantage) = (int(input()), 0, 0)
(roboCoder, bionicSolver) = ([int(i) for i in input().split()], [int(i) for i in input().split()])
for i in range(n):
	if roboCoder[i] == 1 and bionicSolver[i] == 0:
		roboAdvantage += 1
	elif roboCoder[i] == 0 and bionicSolver[i] == 1:
		bionicAdvantage += 1
if roboAdvantage == 0:
	print(-1)
elif roboAdvantage > bionicAdvantage:
	print(1)
else:
	print(bionicAdvantage // roboAdvantage + 1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	poss = False
	diff = 0
	diff2 = 0
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			poss = True
			diff2 += 1
		if a[i] == 0 and b[i] == 1:
			diff += 1
	from math import ceil
	print(ceil((diff + 1) / diff2) if poss else -1)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	r = list(map(int, input().split()))
	b = list(map(int, input().split()))
	free = 0
	diff = 0
	for idx in range(n):
		if r[idx] == 1 and b[idx] == 0:
			free += 1
		elif r[idx] == 0 and b[idx] == 1:
			diff += 1
	if free == 0:
		print(-1)
		return
	print(diff // free + 1)
main()


n = int(input().strip())
rob = input().strip().split(' ')
bio = input().strip().split(' ')
score_dif = 0
c_count = 0
i = 0
while i < n:
	val = rob[i] + bio[i]
	if val == '10':
		c_count += 1
	elif val == '01':
		score_dif += 1
	i += 1
if score_dif >= 0 and c_count == 0:
	print(-1)
else:
	print(score_dif // c_count + 1)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
wrong = 0
right = 0
while i < n:
	if r[i] == 0 and b[i] == 1:
		wrong += 1
	elif r[i] == 1 and b[i] == 0:
		right += 1
	i += 1
if right > wrong:
	print(1)
elif right != 0:
	print(int(wrong / right) + 1)
else:
	print(-1)


from math import floor
N = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
win = 0
lose = 0
for i in range(N):
	if r[i] != b[i]:
		if r[i] == 1:
			win += 1
		else:
			lose += 1
if win == 0:
	print(-1)
elif win <= lose:
	print(floor(lose / win) + 1)
else:
	print(1)


n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
aa = 0
bb = 1
for i in range(n):
	if a[i] > b[i]:
		aa += 1
	elif b[i] > a[i]:
		bb += 1
ans = int(bb / aa + 0.99999999) if aa != 0 else -1
print(ans)


import sys
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rw = 0
bw = 0
d = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		rw += 1
	elif r[i] == 0 and b[i] == 1:
		bw += 1
	elif r[i] == b[i]:
		d += 1
if d == n:
	print(-1)
elif rw > bw:
	print(1)
elif rw > 0:
	ans = bw // rw
	print(ans + 1)
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(s1, s2) = (0, 0)
(ct, ct2) = (0, 0)
for i in range(n):
	if a[i] and (not b[i]):
		ct += 1
	elif a[i] and b[i]:
		ct2 += 1
	s1 += a[i]
	s2 += b[i]
if s1 > s2:
	print(1)
elif ct:
	v = (s2 - ct2) // (s1 - ct2) + 1
	print(v)
else:
	print(-1)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().split(' ')))
	b = list(map(int, sys.stdin.readline().split(' ')))
	c = 0
	d = 0
	for i in range(n):
		if a[i] != b[i]:
			if a[i] == 1:
				c += 1
			else:
				d += 1
	if c == 0:
		print(-1)
		continue
	v = (d + 1) // c
	if v * c < d + 1:
		print(v + 1)
	else:
		print(v)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


import math
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
if sum(a1) > sum(a2):
	print(1)
elif sum(a1) == 0 or sum(a2) == n:
	print(-1)
else:
	zc = 0
	for i in range(n):
		if a2[i] == 0 and a1[i] == 1:
			zc += 1
	if zc == 0:
		print(-1)
	else:
		print(math.ceil((sum(a2) - sum(a1) + zc + 1) / zc))


def robo(n, b, a):
	if a == b:
		return -1
	(x, y) = (0, 0)
	for i in range(n):
		if a[i] == 1 and b[i] == 0:
			x += 1
		elif a[i] == 0 and b[i] == 1:
			y += 1
	if x == 0:
		return -1
	return y // x + 1
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(robo(n, b, a))


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = 1
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	hashm = {}
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		n = inp()
		a = inlt()
		b = inlt()
		a_win = 0
		b_win = 0
		for i in range(n):
			if a[i] == 1 and b[i] == 0:
				a_win = a_win + 1
			elif b[i] == 1 and a[i] == 0:
				b_win += 1
		if a_win == 0:
			print(-1)
			continue
		b_win += 1
		print(math.ceil(b_win / a_win))
main()


import math
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
countr = 0
countb = 0
if r == b:
	print(-1)
else:
	for i in range(n):
		if r[i] != b[i]:
			if b[i] == 1:
				countb += 1
			if r[i] == 1:
				countr += 1
	if countr == 0:
		print(-1)
	else:
		print(math.floor(countb / countr) + 1)


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
f = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		f = 1
if f == 0:
	print(-1)
	exit()
g = 0
bg = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		g += 1
	elif a[i] == 0 and b[i] == 1:
		bg += 1
if g > bg:
	print(1)
else:
	low = 0
	high = 10 ** 18
	ans = -1
	while low <= high:
		mid = (low + high) // 2
		if mid * g > bg:
			ans = mid
			high = mid - 1
		else:
			low = mid + 1
	print(ans)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
coder = [int(x) for x in input().split()]
solver = [int(x) for x in input().split()]
res = 0
c1 = 0
c2 = 0
for i in range(t):
	if coder[i] and (not solver[i]):
		c1 += 1
	elif not coder[i] and solver[i]:
		c2 += 1
if c1 == 0:
	print(-1)
else:
	print(c2 // c1 + 1)


import sys
nums = int(input())
rob1 = input()
rob2 = input()
rob1 = rob1[::2]
rob2 = rob2[::2]
if int(rob1) == 0:
	print(-1)
elif int(rob1) ^ int(rob2) == 0:
	print(-1)
elif '0' not in rob2:
	print(-1)
else:
	biosonic = 0
	robocodr = 0
	for i in range(nums):
		if rob1[i] == '1' and rob2[i] == '0':
			robocodr += 1
		elif rob1[i] == '0' and rob2[i] == '1':
			biosonic += 1
	minMax = 0
	while True:
		minMax += 1
		if minMax * robocodr > biosonic:
			print(minMax)
			break
sys.exit()


n = int(input())
l1 = list(input().split())
l2 = list(input().split())
l3 = []
l4 = []
for i in range(0, len(l1)):
	l1[i] = int(l1[i])
	l2[i] = int(l2[i])
	l3.append(l2[i] - l1[i])
	l4.append(l1[i] - l2[i])
y = l3.count(1)
x = l4.count(1)
if x > y:
	print(1)
elif x == 0:
	print(-1)
elif x <= y:
	print(y // x + 1)


n = int(input())
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
c = 0
for i in range(n):
	if a1[i] == 1 and a2[i] == 0:
		c += 1
a2 = sum(a2)
if c == 0:
	print(-1)
else:
	a1.append(0)
	for i in range(102):
		a1 = a1[:-1]
		a1.append(c * i)
		x = sum(a1)
		if sum(a1) > a2:
			print(i + 1)
			break


import math
t = int(input())
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
ca = 0
cb = 0
for i in range(t):
	if b[i] == 1 and a[i] == 0:
		cb += 1
	if a[i] == 1 and b[i] == 0:
		ca += 1
if ca == 0:
	print(-1)
else:
	print(math.ceil((cb + 1) / ca))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
n = int(input())
a = array()
b = array()
res = [a[i] - b[i] for i in range(n)]
scoreA = 0
scoreB = 0
for i in res:
	if i > 0:
		scoreA += 1
	elif i < 0:
		scoreB += 1
if scoreA == 0:
	print(-1)
	exit()
if scoreA > scoreB:
	print(1)
	exit()
else:
	print(scoreB // scoreA + 1)


import math
n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
count2 = 0
count1 = 0
total = 0
for i in range(n):
	if arr1[i] == 0 and arr2[i] == 1:
		count2 += 1
	elif arr1[i] == 1 and arr2[i] == 0:
		count1 += 1
	elif arr1[i] == 1 and arr2[i] == 1:
		continue
	else:
		continue
if count1 == 0:
	print(-1)
elif count1 > count2:
	print(1)
else:
	total = math.ceil((count2 + 1) / count1)
	print(total)


import math
a = int(input())
m1 = list(map(int, input().split()))
m2 = list(map(int, input().split()))
if m1 == m2:
	print(-1)
else:
	l1 = sum(m2)
	count = 0
	c1 = 0
	for i in range(a):
		if m1[i] == 1 and m2[i] == 0:
			count += 1
		elif m1[i] == 1:
			c1 += 1
	c2 = l1 - c1 + 1
	if count == 0:
		print(-1)
	else:
		print(math.ceil(c2 / count))


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def msi():
	return map(str, input().strip().split(' '))

def lsi():
	return list(msi())
n = ii()
a = li()
b = li()
c1 = 0
c2 = 0
for i in range(n):
	if a[i] == 1 and b[i] == 0:
		c1 += 1
	if b[i] == 1 and a[i] == 0:
		c2 += 1
if c1 == c2:
	if c1 == 0:
		print('-1')
	else:
		print('2')
elif c1 > c2:
	print('1')
elif c1 == 0:
	print('-1')
else:
	x = 1
	c = c1
	while c1 <= c2:
		x += 1
		c1 = c * x
	print(x)


import sys
input = sys.stdin.readline
from math import *
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
maxi = -1
c = 0
d = 0
for i in range(n):
	if a[i] > b[i]:
		maxi = n + 1
		d += 1
	elif a[i] < b[i]:
		c += 1
print(maxi if maxi < 0 else int(floor(c / d)) + 1)


import math
n = int(input())
str1 = input()
str2 = input()
x = str1.split(' ')
y = str2.split(' ')
a = 0
b = 0
for i in range(n):
	p = int(x[i])
	q = int(y[i])
	if p > q:
		a += 1
	elif q > p:
		b += 1
if a == 0:
	print(-1)
else:
	ans = math.ceil((b + 1) / a)
	print(ans)


n = int(input())
arr = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
count1 = 0
count2 = 0
count3 = 0
for i in range(n):
	if arr[i] == 1 and arr2[i] != 1:
		count1 += 1
	elif arr[i] != 1 and arr2[i] == 1:
		count2 += 1
	else:
		count3 += 1
if count3 == n or count1 == 0:
	print('-1')
else:
	for i in range(1, count2 + 2):
		if i * count1 > count2:
			print(i)
			break


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
rr = 0
bb = 0
for i in range(n):
	if r[i] > b[i]:
		rr += 1
	elif r[i] < b[i]:
		bb += 1
if rr == 0:
	print('-1')
else:
	print(max(1, bb // rr + 1))


n = int(input())
ch = input()
L1 = [int(i) for i in ch.split()]
ch = input()
L2 = [int(i) for i in ch.split()]
s1 = sum(L1)
s2 = sum(L2)
x = 0
for i in range(n):
	if L1[i] == 1 and L2[i] == 0:
		x += 1
if x == 0:
	print(-1)
elif s1 > s2:
	print(1)
else:
	print(1 + (s2 - (s1 - x)) // x)


def main():
	n = input()
	rci = list(map(int, input().split()))
	bsi = list(map(int, input().split()))
	a0 = sum((i & ~j for (i, j) in zip(rci, bsi)))
	a1 = sum((j & ~i for (i, j) in zip(rci, bsi)))
	try:
		print(a1 // a0 + 1)
	except ZeroDivisionError:
		print(-1)
main()


n = int(input())
a = [int(num) for num in input().split()]
b = [int(num) for num in input().split()]
b_ahead = 0
a_ahead = 0
for i in range(n):
	if a[i] == 0 and b[i] == 1:
		b_ahead += 1
	elif a[i] == 1 and b[i] == 0:
		a_ahead += 1
b_ahead += 1
if a_ahead == 0:
	print(-1)
else:
	c = (b_ahead + a_ahead - 1) // a_ahead
	print(c)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
onezero = 0
zerone = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		onezero += 1
	if r[i] == 0 and b[i] == 1:
		zerone += 1
if onezero > zerone:
	print(1)
elif onezero == 0:
	print(-1)
elif zerone == 0:
	print(2)
else:
	ans = zerone // onezero + 1
	print(ans)


n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
can_change = False
only_r_count = 0
only_b_count = 0
for i in range(n):
	if r[i] == 1 and b[i] == 0:
		only_r_count += 1
	elif b[i] == 1 and r[i] == 0:
		only_b_count += 1
if only_r_count == 0:
	print(-1)
else:
	print(only_b_count // only_r_count + 1)


problems = int(input())
robo = list(map(int, input().split()))
bio = list(map(int, input().split()))
robo_win = 0
bio_win = 0
for i in range(problems):
	if robo[i] > bio[i]:
		robo_win += 1
	elif robo[i] < bio[i]:
		bio_win += 1
for i in range(1, 1000):
	if bio_win < robo_win * i:
		print(i)
		break
	if i == 999:
		print(-1)


n = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
c = 0
for i in range(n):
	if l1[i] == 1 and l2[i] == 0:
		c += 1
if c == 0:
	print(-1)
else:
	k = l1.count(1)
	kk = l2.count(1)
	count = kk - k + c
	if kk - k + c <= 0:
		print(1)
	else:
		print(count // c + 1)


import math
t = int(input())
s = input().split(' ')
s2 = input().split(' ')
robo = 0
bio = 0
for ii in range(t):
	a = int(s[ii])
	b = int(s2[ii])
	if a - b == 1:
		robo += 1
	elif a - b == -1:
		bio += 1
if robo == 0:
	print(-1)
else:
	print(int(bio / robo) + 1)


import math
q = 1
for _ in range(q):
	n = int(input())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	a = 0
	b = 0
	for i in range(n):
		if l1[i] == 1 and l2[i] == 0:
			a += 1
		if l2[i] == 1 and l1[i] == 0:
			b += 1
	if a == 0:
		print(-1)
	else:
		print(b // a + 1)


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ex1 = sum((i & ~j for (i, j) in zip(a, b)))
ex2 = sum((j & ~i for (i, j) in zip(a, b)))
try:
	print(ex2 // ex1 + 1)
except ZeroDivisionError:
	print(-1)


def main():
	t = int(input())
	r = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a = 0
	for i in range(t):
		if r[i] == 1 and b[i] == 1:
			a += 1
	rp = r.count(1) - a
	bp = b.count(1) - a
	if rp < 1:
		print(-1)
		exit()
	o = bp // rp + 1
	print(o)
main()


import sys, math
it = iter(sys.stdin.read().splitlines())
n = int(next(it))
m = [int(x) for x in next(it).split()]
k = [int(x) for x in next(it).split()]
cando = 0
cannotdo = 0
for i in range(n):
	if m[i] > k[i]:
		cando += 1
	if k[i] and (not m[i]):
		cannotdo += 1
if cando == 0:
	print(-1)
else:
	print(int(math.ceil((cannotdo + 1) / cando)))