#include <iostream>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)

int main(){  
  long long n, m, r, inf = 1000000000, ans = 1000000000;
  cin >> n >> m >> r;
  long long vr[8], rr[8], abc[201][201] = {};
  rep(i, n){
    rep(j, n){
      if (i == j) abc[i][j] = 0;
      else abc[i][j] = inf;
    }
  }
  
  rep(i, r) cin >> vr[i], --vr[i];
  rep(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    abc[a][b] = c;
    abc[b][a] = c;
  }
  rep(k, n) {
    rep(i, n) {
      rep(j, n) {
        abc[i][j] = min(abc[i][j], abc[i][k] + abc[k][j]);
      }
    }
  }
  rep(i, r) rr[i] = i;

  do {
    long long tmp = 0;
    rep(i, r-1) {
      tmp += abc[vr[rr[i]]][vr[rr[i+1]]];
    }
    ans = min(ans, tmp);
  } while (next_permutation(rr, rr + r));

  cout << ans << endl;
}