#abc308b. [abc308_b]Default Price

[abc308_b]Default Price

Problem Statement

Takahashi ate NN plates of sushi at a sushi restaurant. The color of the ii-th plate is represented by a string CiC_i.

The price of a sushi corresponds to the color of the plate. For each i=1,ldots,Mi=1,\\ldots,M, the sushi on a plate whose color is represented by a string DiD_i is worth PiP_i yen a plate (yen is the currency of Japan). If the color does not coincide with any of D1,ldotsD_1,\\ldots, and DMD_M, it is worth P0P_0 yen a plate.

Find the total amount of the prices of sushi that Takahashi ate.

Constraints

  • 1leqN,Mleq1001\\leq N,M\\leq 100
  • CiC_i and DiD_i are strings of length between 11 and 2020, inclusive, consisting of lowercase English letters.
  • D1,ldotsD_1,\\ldots, and DMD_M are distinct.
  • 1leqPileq100001\\leq P_i\\leq 10000
  • NN, MM, and PiP_i are integers.

Input

The input is given from Standard Input in the following format:

NN MM C1C_1 ldots\\ldots CNC_N D1D_1 ldots\\ldots DMD_M P0P_0 P1P_1 ldots\\ldots PMP_M

Output

Print the answer as an integer.


Sample Input 1

3 2
red green blue
blue red
800 1600 2800

Sample Output 1

5200

A blue plate, red plate, and green plate are worth P1=1600P_1 = 1600, P2=2800P_2 = 2800, and P0=800P_0 = 800 yen, respectively.

The total amount of the prices of the sushi that he ate is 2800+800+1600=52002800+800+1600=5200 yen.


Sample Input 2

3 2
code queen atcoder
king queen
10 1 1

Sample Output 2

21