URI Online Judge | 1802 | [P1]

Books Catalog

By Thalyson Nepomuceno, Universidade Estadual do Ceará BR Brazil

Timelimit: 2

Bino is preparing a book catalog. He is organizing a catalog with K different sets of books to sell in your online store. Each set of books consists of five books, one for each subject (portuguese, mathematics, physics, chemistry and biology). Two sets of books are considered distinct if there is at least one book that is at one and the other is not. Bino want to expose on the site only the most expensive distinct sets, and asked for your help.

The value of each set is the sum of the values of each book that's in it. Your task is to calculate the total value of K more expensive distinct sets of books. In case of a draw among the most expensive sets, Bino choose any more expensive set.

Input

The input consists of 6 lines: The first line contains an integer P (5 ≤ P ≤ 10), representing that Bino has P different types of portuguese books, followed by P integers v(1 ≤ vi ≤ 1000), representing the values ​​of each Portuguese book. The second line contains an integer M (5 ≤ M ≤ 10), representing that Bino has M different types of math books, M integers v(1 ≤ vi ≤ 1000), representing the values ​​of each math book. The third line contains an integers F (5 ≤ F ≤ 10), representing that Bino has F different types of physics books, followed by F integers vi (1 ≤ v≤ 1000) representing the values ​​of each physics book. The fourth line contains an integer Q (5 ≤ Q ≤ 10) representing that Bino has Q different types  of chemistry books, followed by Q integers v(1 ≤ vi ≤ 1000) representing the values ​​of each chemistry book. The fifth line contains an integer B (5 ≤ B ≤ 10), representing that Bino has B different types of biology books, followed by B integers v(1 ≤ v≤ 1000) representing the values ​​of each biology book. The sixth line contains an integer K (1 ≤ KM*P*Q*F*B) representing the amount of different sets of books in books catalog.

Output

Print the sum of K more expensive distinct sets of books.

Input Sample Output Sample

5 2 5 6 3 8
5 9 6 3 1 5
5 4 8 5 2 6
5 3 2 4 9 5
5 7 8 5 1 4
1

42

Input Sample Output Sample

5 2 5 6 3 8
5 9 6 3 1 5
5 4 8 5 2 6
5 3 2 4 9 5
5 7 8 5 1 4
10

397