航天员

航天员

暂无测试数据。

题目背景

中科信息第一次月赛第一题。

题目描述

中国航天事业迅猛发展。航天员飞往宇宙需要带上充足的物资,如水,面包,氧气,氮气。但是飞船携带物资有限,而地面物资无限,现给出飞船各种载物能力和地面物资种类,每种物资可以选无限多个,并给出每种物资携带量与生存天数的比例关系,求宇航员最多能在太空住几天。

注意:物资承载能力互不干扰,天数只能为整数,不考虑发射与返航时所消耗的物资。

Input

On first line: one number n,for kinds number of goods.
Second line:four numbers a,b,c,d,and for limit_a,limit_b,limit_c,limit_d in spaceship.
Third line:one number q,for one unit goods_value can live q days;
Next n lines:each line has five numbers e,f,g,h,for one good's weight_1,weight_2,weight_3,weight_4,value.

Output

One number, the max day in space.

Sample 1

Input

4
10 20 30 40
3
1 2 3 4 5
2 5 1 1 3
1 3 2 6 8
0 1 4 0 1

Output

---

Limitation

\( n\le 50\), \( 0\le a,b,c,d,e,f,g,h,q \le 20,30,40,50,20,30,40,50,20\).
1s, 128MiB for each test case.

信息

ID
1002
难度
3
分类
背包 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者