n = int(input().strip())
_tmp_w_list = []
_tmp_n_list = []
_tmp_w_list = list(map(int, input().split()))
_tmp_n_list = list(map(int, input().split()))
m_list = zip(_tmp_w_list, _tmp_n_list)
m_list = sorted(m_list, key=lambda x: x[0])
result = [0] # 初始化,如果没有砝码,则只能称出来重量为0
for i in range(1, n+1):
tmp = result.copy()
for each in tmp:
for num in range(1, m_list[i-1][1]+1):
result.append(each+m_list[i-1][0]*num)
result = list(set(result))
print(len(result))



京公网安备 11010502036488号