void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, m, t; rd(n, m, t);
  auto r=readln.split.to!(int[]);
  foreach(ref e; r) e--;
  auto d=new long[][](n, n);
  const long inf=1_000_000_000_000_000_000;
  foreach(i; 0..n) fill(d[i], inf);
  foreach(i; 0..n) d[i][i]=0;
  foreach(_; 0..m){
    int a, b; long c; rd(a, b, c);
    a--; b--;
    d[a][b]=d[b][a]=c;
  }

  foreach(k; 0..n){
    foreach(i; 0..n){
      foreach(j; 0..n){
        d[i][j]=min(d[i][j], d[i][k]+d[k][j]);
      }
    }
  }

  auto dp=new long[][](t, (1<<t));
  foreach(i; 0..t) fill(dp[i], inf);
  foreach(i; 0..t) dp[i][0]=0;
  foreach(i; 0..t) dp[i][1<<i]=0;
  foreach(i; 0..(1<<t)){
    foreach(tg; 0..t)if(!(i&(1<<tg))){
      foreach(j; 0..t)if(i&(1<<j)){
        dp[tg][i|(1<<tg)]=min(dp[tg][i|(1<<tg)], 
                              dp[j][i]+d[r[j]][r[tg]]);
      }
    }
  }
  
  long mi=inf;
  foreach(i; 0..t) mi=min(mi, dp[i][(1<<t)-1]);
  writeln(mi);

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}