#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e+18;
enum Type { bakery, town };
struct Edge {
  long long v, d;
};
struct Node {
  long long u;
  vector<Edge> edges;
  Type t = town;
  long long d = INF;
};
vector<Node> g;
multiset<Node> st;
bool operator<(const Node &n1, const Node &n2) {
  if (n1.t == n2.t) return n1.d < n2.d;
  return n1.t < n2.t;
}
void bfs(long long u, vector<Edge> edges) {
  for (Edge e : edges)
    if (g[e.v].d > g[u].d + e.d) {
      st.erase(g[e.v]);
      g[e.v].d = g[u].d + e.d;
      st.insert(g[e.v]);
    }
}
signed main() {
  long long n, m, k;
  cin >> n >> m >> k;
  g.resize(n);
  for (long long i = 0; i < n; ++i) g[i].u = i;
  for (long long i = 0; i < m; ++i) {
    long long u, v, d;
    cin >> u >> v >> d;
    u--;
    v--;
    g[u].edges.push_back({v, d});
    g[v].edges.push_back({u, d});
  }
  if (k == 0 || k == n) {
    cout << -1 << endl;
    exit(0);
  }
  for (long long i = 0; i < k; ++i) {
    long long a;
    cin >> a;
    a--;
    g[a].t = bakery;
    g[a].d = 0;
    st.insert(g[a]);
  }
  while (!st.empty()) {
    long long u = st.begin()->u;
    vector<Edge> edges(st.begin()->edges);
    st.erase(st.begin());
    bfs(u, edges);
  }
  long long ans = INF;
  for (long long i = 0; i < n; ++i)
    if (g[i].t == town) ans = min(ans, g[i].d);
  if (ans == INF)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
