{"raw_statement":[{"iden":"problem statement","content":"There are $N$ towns in the State of Atcoder, connected by $M$ bidirectional roads.\nThe $i$\\-th road connects Town $A_i$ and $B_i$ and has a length of $C_i$.\nJoisino is visiting $R$ towns in the state, $r_1,r_2,..,r_R$ (not necessarily in this order).\nShe will fly to the first town she visits, and fly back from the last town she visits, but for the rest of the trip she will have to travel by road.\nIf she visits the towns in the order that minimizes the distance traveled by road, what will that distance be?"},{"iden":"constraints","content":"*   $2≤N≤200$\n*   $1≤M≤N×(N-1)/2$\n*   $2≤R≤min(8,N)$ ($min(8,N)$ is the smaller of $8$ and $N$.)\n*   $r_i≠r_j (i≠j)$\n*   $1≤A_i,B_i≤N, A_i≠B_i$\n*   $(A_i,B_i)≠(A_j,B_j),(A_i,B_i)≠(B_j,A_j) (i≠j)$\n*   $1≤C_i≤100000$\n*   Every town can be reached from every town by road.\n*   All input values are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$ $R$\n$r_1$ $...$ $r_R$\n$A_1$ $B_1$ $C_1$\n$:$\n$A_M$ $B_M$ $C_M$"},{"iden":"sample input 1","content":"3 3 3\n1 2 3\n1 2 1\n2 3 1\n3 1 4"},{"iden":"sample output 1","content":"2\n\nFor example, if she visits the towns in the order of $1$, $2$, $3$, the distance traveled will be $2$, which is the minimum possible."},{"iden":"sample input 2","content":"3 3 2\n1 3\n2 3 2\n1 3 6\n1 2 2"},{"iden":"sample output 2","content":"4\n\nThe shortest distance between Towns $1$ and $3$ is $4$. Thus, whether she visits Town $1$ or $3$ first, the distance traveled will be $4$."},{"iden":"sample input 3","content":"4 6 3\n2 3 4\n1 2 4\n2 3 3\n4 3 1\n1 4 1\n4 2 2\n3 1 6"},{"iden":"sample output 3","content":"3"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}