import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline #n = int(input()) # #alist = [] input = sys.stdin.readline n,m,l,s,e = map(int,input().split()) edge = [[] for i in range(n*2)] for i in range(m): u,v,t = map(int,input().split()) u-=1 v-=1 edge[2*u].append((2*v,t)) edge[2*v].append((2*u,t)) edge[2*u+1].append((2*v+1,t)) edge[2*v+1].append((2*u+1,t)) toile = set(map(lambda x:int(x)-1,input().split())) start = 0 d = [] dist = [10**18 for i in range(n+n)] heapq.heappush(d,(0,0)) dist[start] = 0 while d: _,now = heapq.heappop(d) if _ > dist[now]: continue y = now % 2 if y == 0 and now // 2 in toile: x = dist[now] if x < s: c = s + 1 elif s <= x < e: c = x + 1 else: c = 10**19 if dist[now+1] > c: dist[now+1] = c heapq.heappush(d,(dist[now+1],now+1)) for to,cost in edge[now]: if dist[to] > dist[now] + cost: dist[to] = dist[now] + cost heapq.heappush(d,(dist[to],to)) print(dist[-1] if dist[-1] != 10**18 else -1)