There are M boxes and N balls. The balls are numbered 1 through N, and the weight of the ball i is w_i. You are also given a sequence a_1,a_2,…,a_K. Each a_j is an integer satisfying 1≤a_j≤N.
Initially, all the boxes are empty. For each j=1,2,…,K in this order, you have to perform the following operation:
Compute the minimum possible total cost of operations.
The first line contains three integers M, N and K (1≤M≤10, 1≤N,K≤104).
The i-th of the next N lines contains an integer w_i (1≤w_i≤104).
The j-th of the next K lines contains an integer a_j (1≤a_j≤N).
Print the minimum total cost.