#include #ifdef LOCAL #include #else #define debug(...) void(0) #endif template std::istream& operator>>(std::istream& is, std::vector& v) { for (auto& e : v) { is >> e; } return is; } template std::ostream& operator<<(std::ostream& os, const std::vector& v) { for (std::string_view sep = ""; const auto& e : v) { os << std::exchange(sep, " ") << e; } return os; } template bool chmin(T& x, U&& y) { return y < x and (x = std::forward(y), true); } template bool chmax(T& x, U&& y) { return x < y and (x = std::forward(y), true); } template void mkuni(std::vector& v) { std::ranges::sort(v); auto result = std::ranges::unique(v); v.erase(result.begin(), result.end()); } template int lwb(const std::vector& v, const T& x) { return std::distance(v.begin(), std::ranges::lower_bound(v, x)); } using ll = long long; using namespace std; const ll INF = 1e18; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); int N, M, L, S, E; cin >> N >> M >> L >> S >> E; vector>> G(N); for (; M--;) { int a, b, t; cin >> a >> b >> t; a--, b--; G[a].emplace_back(b, t); G[b].emplace_back(a, t); } vector toilet(N, false); for (; L--;) { int T; cin >> T; toilet[--T] = true; } vector dp(N, vector(2, INF)); priority_queue> pq; dp[0][0] = 0; pq.emplace(-dp[0][0], 0, 0); while (not pq.empty()) { auto [val, v, p] = pq.top(); pq.pop(); val *= -1; if (dp[v][p] != val) continue; if (p == 0 and toilet[v] and val < S + E) { if (chmin(dp[v][1], max(1LL * S, val) + 1)) { pq.emplace(-dp[v][1], v, 1); } } for (auto [u, t] : G[v]) { if (chmin(dp[u][p], val + t)) { pq.emplace(-dp[u][p], u, p); } } } ll ans = dp[N - 1][1]; cout << (ans == INF ? -1 : ans) << "\n"; return 0; }