from heapq import * n, m, l, s, e = map(int, input().split()) edges = [[] for _ in range(n)] for _ in range(m): u, v, w = map(int, input().split()) u -= 1 v -= 1 edges[u].append((v, w)) edges[v].append((u, w)) T = list(map(int, input().split())) tf = [False] * n for t in T: tf[t - 1] = True inf = 1 << 60 dist = [[inf] * n for _ in range(2)] dist[0][0] = 0 hq = [0] while hq: tmp = heappop(hq) t = tmp & 1 tmp >>= 1 d = tmp // n pos = tmp - d * n if dist[t][pos] < d: continue for npos, c in edges[pos]: nd = d + c if t == 0 and nd >= s + e: continue if nd < dist[t][npos]: dist[t][npos] = nd heappush(hq, (nd * n + npos) * 2 + t) if t == 0 and tf[pos]: nd = max(s, d) + 1 if nd < dist[1][pos]: dist[1][pos] = nd heappush(hq, (nd * n + pos) * 2 + 1) ans = dist[1][n - 1] if ans == inf: ans = -1 print(ans)