#include<bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); i++)
#define ll long long
using namespace std;

const ll INF=1LL<<60;
const int N_MAX=210;

int N,M,R;
ll dp[N_MAX][N_MAX];

int main() {
  cin>>N>>M>>R;
  vector<int> r;
  rep(i, R) {
    int x; cin>>x;
    x--;
    r.push_back(x);
  }
  rep(i, N_MAX) {
    rep(j, N_MAX) {
      dp[i][j]=INF;
    }
    dp[i][i]=0;
  }
  rep(i, M) {
    int a,b,c; cin>>a>>b>>c;
    a--; b--;
    dp[a][b]=c;
    dp[b][a]=c;
  }
  rep(k, N) {
    rep(i, N) {
      rep(j, N) {
        dp[i][j]=min(dp[i][j], dp[i][k]+dp[k][j]);
      }
    }
  }
  ll res=INF;
  sort(r.begin(), r.end());
  do {
    ll tmp=0;
    rep(i, r.size()-1) tmp+=dp[r[i+1]][r[i]];
    res=min(res, tmp);
  } while (next_permutation(r.begin(), r.end()));
  cout<<res<<endl;
}