#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const ll INF = 1e18; void solve() { ll n, m, L, S, E; cin >> n >> m >> L >> S >> E; vector>> g(n); { map, ll> mp; rep(mi, m) { ll a, b, t; cin >> a >> b >> t, a--, b--; pair k = {a, b}; if (mp.count(k) == 1) t = min(t, mp[k]); mp[k] = t; } for (const auto &[k, t] : mp) { const auto [a, b] = k; g[a].emplace_back(b, t); g[b].emplace_back(a, t); } } vector f(n, false); rep(i, L) { ll t; cin >> t, t--; f[t] = true; } priority_queue> que; vector dist(n, INF); que.emplace(0, 0); dist[0] = 0; rep(ti, 2) { while (!que.empty()) { auto [cd, u] = que.top(); que.pop(); cd *= -1; if (dist[u] < cd) continue; for (const auto &[v, t] : g[u]) { ll nd = cd + t; if (dist[v] <= nd) continue; dist[v] = nd; que.emplace(-dist[v], v); } } if (ti) break; priority_queue> nex; rep(i, n) { if (!f[i]) { dist[i] = INF; } else if (dist[i] <= S) { dist[i] = S + 1; } else if (dist[i] < S + E) { dist[i] += 1; } else { dist[i] = INF; } if (dist[i] < INF) { nex.emplace(-dist[i], i); } } swap(que, nex); } ll ans = dist[n - 1]; if (ans == INF) ans = -1; cout << ans << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; for (int t = 0; t < T; t++) { solve(); } return 0; }