#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

class Warshall_Floyd{
  //Warshall-Floyd algorithm
  //calculation time complexity: O(|V|^3)
  //all vertex-vertex minimum distance
  private:
    ll V;
    vector<vector<ll> > d;

  public:
    Warshall_Floyd(ll V, vector<ll> From, vector<ll> To, vector<ll> Cost){
      //num of vertex
      this->V = V;
      d.resize(V);
      for(ll i=0; i<V; ++i){
        d[i].resize(V, INFLL-1);
        d[i][i] = 0;
      }
      ll E = (ll)From.size();
      if((ll)To.size() != E || (ll)Cost.size() != E){
        fprintf(stderr, "Sizes are different, %ld %ld %ld\n", From.size(), To.size(), Cost.size());
        exit(0);
      }

      for(ll i=0; i<E; ++i){
        d[From[i]][To[i]] = Cost[i];
      }
      return;
    };

    ~Warshall_Floyd(void){
      return;
    };

    void shortest_path(void){
      for(ll k=0; k<V; ++k){
        for(ll i=0; i<V; ++i){
          for(ll j=0; j<V; ++j){
            //d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            if(d[i][j] > d[i][k] + d[k][j]){
              d[i][j] = d[i][k] + d[k][j];
            }
          }
        }
      }
      return;
    };

    ll get_distance(ll s, ll e){
      return d[s][e];
    };
};

ll N = 1<<8;
vvll dp(8, vll(N, -1));
vvll Path(8, vll(8, -1));
vll r;

ll search_minimum_path(ll pos_index, ll passed_index){
  if(dp[pos_index][passed_index]>0) return dp[pos_index][passed_index];
  ll passed_index_copy = passed_index;
  ll count=0;
  vll cand(0);
  for(ll i=0; i<r.size(); ++i){
    if(passed_index_copy%2==0) cand.push_back(i);
    passed_index_copy>>=1;
  }

  if(cand.size()==0) return 0;
  if(cand.size()==1){
    return dp[pos_index][passed_index] = Path[pos_index][cand[0]];
  }

  ll ans = INFLL;
  for(ll i=0; i<cand.size(); ++i){
    ll new_pos = cand[i];
    ll passed_index_add = 1<<new_pos;
    ans = min(ans, search_minimum_path(new_pos, passed_index+passed_index_add) + Path[pos_index][new_pos]);
  }

  return dp[pos_index][passed_index] = ans;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, M, R;
  cin >> N >> M >> R;
  r.resize(R);
  REP(i, R){
    cin >> r[i];
    r[i]--;
  }
  vll From(2*M), To(2*M), Cost(2*M);
  REP(i, M){
    cin >> From[i] >> To[i] >> Cost[i];
    From[i]--;
    To[i]--;
    To[i+M] = From[i];
    From[i+M] = To[i];
    Cost[i+M] = Cost[i];
  }

  Warshall_Floyd WF(N, From, To, Cost);

  WF.shortest_path();

  for(ll s=0; s<R; ++s){
    for(ll e=0; e<R; ++e){
      Path[s][e] = WF.get_distance(r[s], r[e]);
    }
  }

  ll ans = INFLL;
  for(ll s=0; s<R; ++s){
    ll state=1<<s;
    ans = min(ans, search_minimum_path(s, state));
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 2432