P17701 [HackerEarth] Miranda lives in a city containing N junctions and M bidirectional roads between some pairs of these junctions.Miranda is a programming enthusiast - though in her spare time she does ma
普及
题目描述

Miranda lives in a city containing N junctions and M bidirectional roads between some pairs of these junctions.Miranda is a programming enthusiast - though in her spare time she does make time for a bit of creative writing . She takes part in Individual Creative Penning Contest organized by the Annual Cultural Melange (ACM ICPC) . The competition is on Sunday and it is already Saturday . Miranda realizes she needs to buy K items for her competition tomorrow . Each of these K items can be found in exactly one junction in her city.

Miranda has to starts from her school which is located in junction number 1 and ultimately must reach her home , in junction number N . On her way , Miranda must visit each of the K junctions that keep the materials required for her competition . Miranda can visit these K junctions in any order , and in doing so can cross a particular city multiple times if she needs to .

You must find the minimum distance that Miranda must cover from her school to home such that she visits each of the K junctions atleast once.

Input
The first line contains the integers N,M and K.
The next M lines are of the form : u v c which denotes there is a bidirectional road joining u and v which is of length c.
The next line contains K integers-the numbers of the junctions that Miranda has to visit on her path .

Output
Print a single integer-the answer to the problem stated above.

Constraints
2 ≤ N ≤ 400
1 ≤ M ≤ N*(N-1)/2
0 ≤ K ≤ 15
1 ≤ u,v ≤ N,1 ≤ c ≤ 1000
None of the K junctions that has the material that Miranda needs is 1 or N.

SAMPLE INPUT
3 3 1
1 3 690
2 3 445
2 1 620
2

SAMPLE OUTPUT
1065

输入格式

见题面

输出格式

见题面

样例输入
36 44 5 27 25 501 17 24 193 27 33 575 17 9 527 26 19 415 30 16 794 17 18 239 16 13 224 34 4 142 24 28 71 31 8 277 34 29 944 8 28 139 22 4 746 25 19 28 15 27 47 14 26 665 14 36 671 11 4 165 24 4 628 1 28 857 31 35 692 7 16 619 6 27 957 10 31 384 2 31 171 15 29 850 20 25 841 32 21 5 3 8 10 23 24 377 20 1 506 26 11 202 11 12 304 27 7 384 16 10 968 27 24 97 11 14 974 11 36 544 20 32 590 31 28 44 33 32 820 24 5 885 32 10 183 33 21 26 23 9
样例输出
147