#include //#include using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n) - 1; i >= 0; --i) #define rrep2(i,l,r)for(int i=(r) - 1;i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, l, st, ed; cin >> n >> m >> l >> st >> ed; struct Edge { int from; int to; int cost; Edge(int from, int to, int cost) :from(from), to(to), cost(cost) {} }; ed += st; vector to(n, vector()); vectort(n); rep(i, m) { int a, b, t; cin >> a >> b >> t; a--, b--; to[a].push_back(Edge(a, b, t)); to[b].push_back(Edge(b, a, t)); } rep(i, l) { int p; cin >> p; p--; t[p] = true; } vector dp(n, vector(2, LINF)); dp[0][0] = 0; std::priority_queue, std::vector>, std::greater>> pq; pq.push({ 0,{0,0} }); while (!pq.empty()) { auto top = pq.top(); long long cost = top.first; int pos = top.second.first; int flg = top.second.second; pq.pop(); if (dp[pos][flg] < cost) continue; for (auto e : to[pos]) { { long long ncost = cost + e.cost; long long npos = e.to; if (chmin(dp[npos][flg], ncost)) { pq.push({ ncost,{npos,flg} }); } } if (0 == flg && t[pos]) { long long ncost = cost; if (ncost >= ed)continue; chmax(ncost, st); ncost += 1; long long npos = pos; if (chmin(dp[npos][1], ncost)) { pq.push({ ncost,{npos,1} }); } } } } if (dp[n - 1][1] == LINF)dp[n - 1][1] = -1; cout << dp[n - 1][1] << endl; return 0; }