#include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) using ll = long long; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr double EPS = 1e-8; constexpr int MOD = 998244353; // constexpr int MOD = 1000000007; constexpr int DY4[]{1, 0, -1, 0}, DX4[]{0, -1, 0, 1}; constexpr int DY8[]{1, 1, 0, -1, -1, -1, 0, 1}; constexpr int DX8[]{0, -1, -1, -1, 0, 1, 1, 1}; template inline bool chmax(T& a, U b) { return a < b ? (a = b, true) : false; } template inline bool chmin(T& a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << fixed << setprecision(20); } } iosetup; template struct Edge { CostType cost; int src, dst; explicit Edge(const int src, const int dst, const CostType cost = 0) : cost(cost), src(src), dst(dst) {} auto operator<=>(const Edge& x) const = default; }; int main() { int n, m, l, s, e; cin >> n >> m >> l >> s >> e; vector>> graph(n); while (m--) { int a, b, t; cin >> a >> b >> t; --a; --b; graph[a].emplace_back(a, b, t); graph[b].emplace_back(b, a, t); } vector has_wc(n, false); while (l--) { int t; cin >> t; --t; has_wc[t] = true; } vector dist(n * 2, LINF); dist[0] = 0; priority_queue, vector>, greater>> que; que.emplace(dist[0], 0); while (!que.empty()) { const auto [d, i] = que.top(); que.pop(); if (d > dist[i]) continue; if (i < n && has_wc[i] && dist[i] <= s + e - 1 && chmin(dist[i + n], max(dist[i], ll{s}) + 1)) { que.emplace(dist[i + n], i + n); } for (const Edge& edge : graph[i % n]) { const int dst = edge.dst + (i < n ? 0 : n); if (chmin(dist[dst], dist[i] + edge.cost)) que.emplace(dist[dst], dst); } } cout << (dist.back() == LINF ? -1 : dist.back()) << '\n'; return 0; }