One lady works the register of the school canteen. Students like her partly because she keeps their bills as small as she can.
Her method is simple. Every meal sold in the canteen has a fixed price, and one set menu is on sale each day. A set menu consists of 4 meals, usually a soup, a main course, a side dish and a dessert, and its price is at most the sum of the prices of those 4 meals. When charging a set menu comes out cheaper than charging the meals on the tray one by one, she charges the set menu. She charges a set price even when the tray holds fewer than all 4 meals of the set.
The bill for m set menus is fixed as follows. The sets cost m×X, and for each meal of the set menu at most m portions are covered by the sets and are not charged separately. Every portion left uncovered is charged at its own price. She picks the m that makes the bill smallest.
You stand in front of the register with your tray. Write a program that determines the amount you have to pay.
The first line contains the number of meals sold in the canteen, K (1≤K≤20). For simplicity the meals are denoted by the integers from 1 to K.
The second line contains K integers. The ith number is the price of meal i, between 1 and 250.
The third line contains the price of the set menu, X (1≤X<1000).
The fourth line contains the labels of the 4 meals that form the set menu. The four labels are different from each other.
The fifth line contains the number of meals on your tray, T (1≤T≤20).
The sixth line contains the labels of the T meals on your tray. The same meal may be taken in several portions.
Print the amount you have to pay as an integer on the first line.
In the first example the tray holds meals 1, 3 and 4, which belong to the set menu, so the lady charges those three portions as one set menu. Meals 6 and 7 are not part of the set, so they are charged at their own prices.
In the second example the tray holds two portions of meal 1. The lady charges one of them together with one portion of meal 2 as a single set menu and charges the other portion separately, because a second set menu would cost more. Meal 6 is taken twice as well, but it is not part of the set, so both portions are charged at their own price.