#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
struct Res{int from,to,dis;};
int main(){
    int n,m,r,a,b,c;
    vector<Res> A;
    cin>>n>>m>>r;
    vector<int> R(r);
    rep(i,r) cin>>R[i];
    rep(i,m) cin>>a>>b>>c,A.push_back({a,b,c}),A.push_back({b,a,c});
    int D[300][300],dp[300],INF=1e9;
    rep(i,n){
        int s=i+1;
        rep(j,n) dp[j+1]=INF;
        dp[s]=0;
        while(true){
            int x=0;
            for(auto k:A) if(dp[k.from]>dp[k.to]+k.dis) dp[k.from]=dp[k.to]+k.dis,x=1;
            if(x==0) break;
        }
        rep(j,n) D[s][j+1]=dp[j+1];
    }
    int x=1e9,y;
    sort(R.begin(),R.end());
    do{
        y=0;
        rep(i,r-1) y+=D[R[i]][R[i+1]];
        x=min(x,y);
    }while(next_permutation(R.begin(),R.end()));
    cout<<x;
}