#define w vector
#define z double
#define q int
#include<iostream>
#include<vector>
#include<algorithm>
#include<limits>
using namespace std;z inf=numeric_limits<z>::infinity();q main(){q n,m,r;cin>>n>>m>>r;w<w<z>>d=w<w<z>>(n,w<z>(n,inf));w<q>v;for(q i=0;i<r;i++){q l;cin>>l;v.push_back(l-1);}
sort(v.begin(),v.end());for(q i=0;i<m;i++){q a,b,c;cin>>a>>b>>c;d[a-1][b-1]=c;d[b-1][a-1]=c;}
for(q k=0;k<n;k++)for(q i=0;i<n;i++)for(q j=0;j<n;j++){d[i][j]=min(d[i][j],d[i][k]+d[k][j]);}
long min_dist=1e9;do{long dist=0;for(q i=0;i<v.size()-1;i++){dist+=d[v[i]][v[i+1]];}min_dist=min(min_dist,dist);}while(next_permutation(v.begin(),v.end()));cout<<min_dist<<endl;}
