/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define sum(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

template <class T>
struct Dijkstra {
private:
  int n;
  vector<vector<pair<T, T>>> graph;

public:
  vector<T> shortest_path;
  Dijkstra(vector<vector<pair<T, T>>> &G) : n(G.size()) { //
    graph = G;
    shortest_path.assign(n, (T)INF);
  }
  void dijkstra(int s) {
    rep(i, n) {
      shortest_path[i] = (T)INF;
    }
    shortest_path[s] = 0;
    priority_queue<pair<T, T>, vector<pair<T, T>>, greater<>> que;
    que.push({0, s});
    while (!que.empty()) {
      pair<T, T> p = que.top();
      que.pop();
      int v = p.second;
      if (shortest_path[v] < p.first) continue;
      for (auto e : graph[v]) {
        if (shortest_path[e.first] > shortest_path[v] + e.second) {
          shortest_path[e.first] = shortest_path[v] + e.second;
          que.push({shortest_path[e.first], e.first});
        }
      }
    }
  }
};

class DJoisinosTravel {
public:
  static void solve(istream &cin, ostream &cout) {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    rep(i, R) cin >> r[i];
    vector<vector<pair<int, int>>> graph(N);
    rep(i, M) {
      int A, B, C;
      cin >> A >> B >> C;
      graph[A - 1].emplace_back(B - 1, C);
      graph[B - 1].emplace_back(A - 1, C);
    }
    Dijkstra<int> d(graph);
    vector<vector<int>> path(R);
    rep(i, R) {
      d.dijkstra(r[i] - 1);
      path[i] = d.shortest_path;
    }
    vector<vector<int>> shortest_path(R, vector<int>(R));
    rep(i, R) {
      rep(j, R) {
        shortest_path[i][j] = path[i][r[j] - 1];
      }
    }
    vector<vector<int>> dp((1 << R), vector<int>(R, INF));
    rep(i, R) dp[0][i] = 0;
    rep(i, (1 << R) - 1) {
      rep(j, R) {
        rep(k, R) {
          if (((i >> k) & 1) == 0) {
            dp[i | (1 << k)][k] = min(dp[i | (1 << k)][k], dp[i][j] + shortest_path[j][k]);
          }
        }
      }
    }
    cout << MIN(dp[(1 << R) - 1]) << endl;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  DJoisinosTravel solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 1792