#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define INF 1 << 30 - 1

int main() {
  int n, m, r; cin >> n >> m >> r;
  vvi g(n, vi(n, INF));
  rep(i, n) g[i][i] = 0;
  vi rs(r);
  rep(i, r) cin >> rs[i];
  rep(i, m) {
    int a, b, c; cin >> a >> b >> c;
    --a; --b;
    g[a][b] = g[b][a] = c;
  }
  rep(i, n) rep(j, n) rep(k, n) g[j][k] = min(g[j][k], g[j][i] + g[i][k]);
  sort(rs.begin(), rs.end());
  int ans = INF;
  do {
    int d = 0;
    for (int i = 0; i < r - 1; ++i) {
      d += g[rs[i] - 1][rs[i + 1] - 1];
    }
    ans = min(ans, d);
  } while (next_permutation(rs.begin(), rs.end()));
  cout << ans << endl;
  return 0;
}