Landline Telephone Network

No attempts yetTime limit2sMemory limit256 MB

Problem

The mayor of RMRCity wants an emergency landline telephone network for the case where a serious disaster cuts the city off from the outside world. Some pairs of buildings can be joined by a direct wire line, and the city engineers have already estimated the cost of joining any such pair.

Find the cheapest network that connects all buildings and obeys the following security rule. A call from building A to building B may be routed along any simple path of the network, that is, a path that never repeats a building. The city also has insecure buildings, each home to one or more people with serious criminal records. The mayor wants only calls meant for an insecure building to reach it. In other words, a call from building A to building B must not pass through an insecure building C that differs from A and B.

Input

The input is a single test case.

The first line contains three integers nn, mm, pp. Here nn is the number of buildings with 1n10001 \le n \le 1000, mm is the number of building pairs that can be connected directly with 0m1000000 \le m \le 100000, and pp is the number of insecure buildings with 0pn0 \le p \le n. The buildings are numbered 11 through nn.

The second line contains the pp distinct numbers of the insecure buildings. When pp is 00, the second line is empty.

Each of the next mm lines contains three integers xix_i, yiy_i, i\ell_i describing one possible direct line. Here xix_i and yiy_i are the two distinct buildings the line joins (1xi,yin1 \le x_i, y_i \le n), and i\ell_i is the estimated cost of joining them (1i100001 \le \ell_i \le 10000). No pair of buildings appears more than once in these mm lines.

Output

Print the cost of the cheapest network that obeys the security rule. If no such network exists, print impossible.