#P2392. kkksc03考前临时抱佛脚

kkksc03考前临时抱佛脚

Description

For this final exam, kkksc03 needs to take 44 subjects. Therefore, he begins practicing problem sets. Each subject has a problem set with s1,s2,s3,s4s_1,s_2,s_3,s_4 problems, and each problem takes some (possibly different) amount of time to complete (A1,A2,,As1A_1,A_2,\ldots,A_{s_1}, B1,B2,,Bs2B_1,B_2,\ldots,B_{s_2}, C1,C2,,Cs3C_1,C_2,\ldots,C_{s_3}, D1,D2,,Ds4D_1,D_2,\ldots,D_{s_4}).

kkksc03 has an ability: his left and right brains can work on 22 different problems simultaneously, but only within the same subject. Therefore, kkksc03 must review one subject at a time.

Since kkksc03 is also in a hurry to handle Luogu's bugs, he wants to finish as quickly as possible. He wants to know the minimum time required to complete all the review.

Input Format

This problem contains 55 lines of input.

  • The first line contains four positive integers s1,s2,s3,s4s_1,s_2,s_3,s_4.
  • The second line contains A1,A2,,As1A_1,A_2,\ldots,A_{s_1}, a total of s1s_1 numbers, representing the time required for each problem in the first subject's problem set.
  • The third line contains B1,B2,,Bs2B_1,B_2,\ldots,B_{s_2}, a total of s2s_2 numbers.
  • The fourth line contains C1,C2,,Cs3C_1,C_2,\ldots,C_{s_3}, a total of s3s_3 numbers.
  • The fifth line contains D1,D2,,Ds4D_1,D_2,\ldots,D_{s_4}, a total of s4s_4 numbers, with the same meaning as above.

Output Format

Output one line: the minimum time to finish all the review.

1 2 1 3		
5
4 3
6
2 4 3

20

Hint

1s1,s2,s3,s4201\leq s_1,s_2,s_3,s_4\leq 20.

$1\leq A_1,A_2,\ldots,A_{s_1},B_1,B_2,\ldots,B_{s_2},C_1,C_2,\ldots,C_{s_3},D_1,D_2,\ldots,D_{s_4}\leq 60$.

Translated by ChatGPT 5