from scipy.sparse import csr_matrix from scipy.sparse.csgraph import shortest_path N,M,K=map(int,input().split()) R=list(map(int,input().split())) mask=[0 for i in range(M)] for i in range(K): mask[R[i]-1]=pow(2,i) weight=[] begin=[] end=[] for i in range(M): A,B,C=map(int,input().split()) for j in range(pow(2,K)): begin+=[A-1+j*N,B-1+j*N] end+=[B-1+(j|mask[i])*N,A-1+(j|mask[i])*N] weight+=[C,C] graph=csr_matrix((weight,(begin,end))) print(int(shortest_path(graph,indices=0)[N*pow(2,K)-1]))