import heapq, sys from collections import defaultdict input = sys.stdin.read data = input().split() N, M, L, S, E = map(int, data[:5]) paths = [(int(data[i]), int(data[i+1]), int(data[i+2])) for i in range(5, 5 + 3 * M, 3)] toilets = list(map(int, data[5 + 3 * M:])) g = defaultdict(dict) for a, b, t in paths: g[a][b] = min(g[a].get(b, float('inf')), t) g[b][a] = min(g[b].get(a, float('inf')), t) def dijkstra(g, start): d = {i: float('inf') for i in g} d[start] = 0 q = [(0, start)] while q: cd, cn = heapq.heappop(q) if cd > d[cn]: continue for n, w in g[cn].items(): dist = cd + w if dist < d[n]: d[n] = dist heapq.heappush(q, (dist, n)) return d try: mt = dijkstra(g, 1) rg = defaultdict(dict) for a in g: for b in g[a]: rg[b][a] = g[a][b] mf = dijkstra(rg, N) min_t = float('inf') for t in toilets: at = mt[t] if at < S: tt = S + 1 + mf[t] elif at <= S + E - 0.99: tt = at + 1 + mf[t] else: continue if tt < min_t: min_t = tt print(-1 if min_t == float('inf') else int(min_t)) except KeyError: print(-1)