#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, L, Q, W, H, R, T, X, Y, S;

struct edge {
    int from, to, cost;
};

void bellmanFord(vector<edge>& es, ll* ds, int dsize, int start)
{
    for (int i = 0; i < dsize; ++i) ds[i] = INT64_MAX;
    ds[start] = 0;
    while (true) {
        bool update = false;
        for (int i = 0; i < es.size(); ++i) {
            edge e = es[i];
            if (ds[e.from] != INT64_MAX && ds[e.to] > ds[e.from] + e.cost) {
                ds[e.to] = ds[e.from] + e.cost;
                update = true;
            }
        }
        if (!update) break;
    }
}

ll costs[8][201];

int getIndex[201];

ll dfs(set<int> rest, int current, int cost)
{
#ifdef DEBUG
    cout << "current node : " << current << " : current cost " << cost << endl;
    cout << " rest nodes : ";
    for (auto r : rest) {
        cout << " " << r  << " : index " << getIndex[r];
    } cerr << endl;
#endif

    if (rest.size() == 1) {
        auto itr = rest.begin();
        int lastCost = costs[getIndex[current]][*itr];
        //cout << "end : " << current << "->" << *itr << " : " << lastCost << endl << endl;;
        return cost + lastCost;
    }

    ll mincost = INT64_MAX;
    for (auto itr = rest.begin(); itr != rest.end(); ++itr) {
        int next = *itr;
        set<int> nextRest = rest; nextRest.erase(next);
        int nextCost = costs[getIndex[current]][next];
        mincost = min(mincost, dfs(nextRest, next, cost + nextCost));
    }
    return mincost;
}

int main()
{
    cin >> N >> M >> R;
    set<int> way;
    for (int i = 0; i < R; ++i) {
        int w; cin >> w;
        way.insert(w);
    }

    vector<edge> edges(2*M);
    for (int i = 0; i < M; ++i) {
        int a, b, c; cin >> a >> b >> c;
        edges[i].from = a; edges[i].to = b; edges[i].cost = c;
        edges[M+i].from = b; edges[M+i].to = a; edges[M+i].cost = c;
    }

    int index = 0;
    for (auto itr = way.begin(); itr != way.end(); ++itr) {
        bellmanFord(edges, costs[index], N+1, *itr);
#ifdef DEBUG
        cout << *itr << "->" << endl;
        for (int j = 0; j < N+1; ++j) {
            cout << j <<  " : " << costs[index][j] << endl;
        }
        cout << endl;
#endif
        getIndex[*itr] = index++;
    }

#ifdef DEBUG
    cerr << endl << "waypoints : ";
    for (auto w : way)
        cerr << " " << w << " : index " << getIndex[w] << ", ";
    cerr << endl;
#endif

    ll mini = INT64_MAX;
    for (auto itr = way.begin(); itr != way.end(); ++itr) {
        set<int> rest = way; rest.erase(*itr);
        mini = min(mini, dfs(rest, *itr, 0));
    }
    cout << mini << endl;

    return 0;
}

Measured memory_bytes: 768