1577: 临时抱佛脚

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:8 Solved:6

Description

        小明决定考前临时抱佛脚。

         这次考试,小明需要考 lns="http://www.w3.org/1998/Math/MathML">4 科。因此要开始刷习题集,每科都有一个习题集,分别有 lns="http://www.w3.org/1998/Math/MathML">�1,�2,�3,�4 道题目,完成每道题目需要一些时间,可能不等(lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��1,lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��2,lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��3,lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��4)。

        小明有一个能力,他的左右两个大脑可以同时计算 lns="http://www.w3.org/1998/Math/MathML">2 道不同的题目,但是仅限于同一科。因此,小明必须一科一科的复习。由于小明还急着去处理电脑上的一些bug,因此他希望尽快把事情做完,所以他希望知道能够完成复习的最短时间。

Input

包含 lns="http://www.w3.org/1998/Math/MathML">5 行数据:

第 lns="http://www.w3.org/1998/Math/MathML">1 行,为四个正整数 lns="http://www.w3.org/1998/Math/MathML">�1,�2,�3,�4。

第 lns="http://www.w3.org/1998/Math/MathML">2 行,为 lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��1 共 lns="http://www.w3.org/1998/Math/MathML">�1 个数,表示第一科习题集每道题目所消耗的时间。

第 lns="http://www.w3.org/1998/Math/MathML">3 行,为 lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��2 共 lns="http://www.w3.org/1998/Math/MathML">�2 个数,表示第二科习题集每道题目所消耗的时间。

第 lns="http://www.w3.org/1998/Math/MathML">4 行,为 lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��3 共 lns="http://www.w3.org/1998/Math/MathML">�3 个数,表示第三科习题集每道题目所消耗的时间。

第 lns="http://www.w3.org/1998/Math/MathML">5 行,为 lns="http://www.w3.org/1998/Math/MathML">�1,�2,…,��4 共 lns="http://www.w3.org/1998/Math/MathML">�4 个数,表示第四科习题集每道题目所消耗的时间。

Output

输出一行,为复习完成所需要的最短时间。

Sample Input Copy

1 2 1 3		
5
4 3
6
2 4 3

Sample Output Copy

20

HINT

。

lns="http://www.w3.org/1998/Math/MathML">1≤�1,�2,…,��1,�1,�2,…,��2,�1,�2,…,��3,�1,�2,…,��4≤60。