#include using namespace std; using ll = long long; ll const inf = (ll)1e18; using P = pair; int main () { int N, M, L; ll S, E; cin >> N >> M >> L >> S >> E; std::vector

gr[200020]; while (M--) { int a, b; ll c; cin >> a >> b >> c; gr[--a].emplace_back(c, --b); gr[b].emplace_back(c, a); } vector D1(N, inf), D2(N, inf); D1[0] = D2[N - 1] = 0; priority_queue, greater

> pque; pque.emplace(0, 0); while (!pque.empty()) { auto [l, u] = pque.top(); pque.pop(); if (l != D1[u]) continue; for (auto [c, v] : gr[u]) { if (D1[v] > l + c) { D1[v] = l + c; pque.emplace(l + c, v); } } } pque.emplace(0, N - 1); while (!pque.empty()) { auto [l, u] = pque.top(); pque.pop(); if (l != D2[u]) continue; for (auto [c, v] : gr[u]) { if (D2[v] > l + c) { D2[v] = l + c; pque.emplace(l + c, v); } } } ll ans = inf * 3; while (L--) { int t; cin >> t; t --; if (D1[t] < S + E) { ans = min(ans, max(D1[t], S) + 1 + D2[t]); } } cout << (ans >= inf ? -1ll : ans) << endl; }