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[]);
  auto d=new int[][](n, n);
  const inf=1_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, 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 int[](1<<t);
  fill(dp, inf); dp[0]=0;
  foreach(i; 0..t) dp[1<<i]=0;
  foreach(i; 0..(1<<t)){
    auto v=new int[](0);
    foreach(tg; 0..t)if(!(i&(1<<tg))){
      foreach(j; 0..t)if(i&(1<<j)){
        dp[i|(1<<tg)]=min(dp[i|(1<<tg)], dp[i]+d[r[j]-1][r[tg]-1]);
      }
    }
  }
  
  writeln(dp[(1<<t)-1]);
}

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));
  }
}