import math
from itertools import permutations
#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
           # if j!= i and a[j]==0:
                #a[j]=2000
                #path[i][j]=-2000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


#フロイド・ワーシャル
def warshall_floyd(glath):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
  
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath





N, M ,R= [int(x) for x in str(input()).split()]  #グラフの大きさ 

r=[int(x) for x in str(input()).split()]


graph=[[0]*N for i in range(N)]


for i in range(M):
	a,b,c=[int(x) for x in str(input()).split()]
	#if a in r and b in r:
	graph[a-1][b-1]=c
	graph[b-1][a-1]=c



#all_cost=warshall_floyd(select_graph)
all_cost=warshall_floyd(graph)


#print(all_cost)
#print(all_cost[r[0]-1-a][r[-1]-1-a])
#print(r[-1]-1-a)

max_count=inf


for i in permutations(r):
        cost=0
        for j in range(len(i)-1):
                
                cost+= all_cost[i[j]-1][i[j+1]-1]
       
        max_count=min(max_count,cost)


#			max_count=min(max_count,all_cost[i-a-1][j-a-1]+all_cost[j-a-1][j-a-1])


print(max_count)    
  

### FIXED CODE ###

import math
from itertools import permutations
#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
           # if j!= i and a[j]==0:
                #a[j]=2000
                #path[i][j]=-2000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


#フロイド・ワーシャル
def warshall_floyd(glath):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   glath[j][i] = glath[i][k] + glath[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath





N, M ,R= [int(x) for x in str(input()).split()]  #グラフの大きさ 

r=[int(x) for x in str(input()).split()]


graph=[[float("inf")]*N for i in range(N)]


for i in range(M):
	a,b,c=[int(x) for x in str(input()).split()]
	#if a in r and b in r:
	graph[a-1][b-1]=c
	graph[b-1][a-1]=c



#all_cost=warshall_floyd(select_graph)
all_cost=warshall_floyd(graph)


#print(all_cost)
#print(all_cost[r[0]-1-a][r[-1]-1-a])
#print(r[-1]-1-a)

max_count=float("inf")


for i in permutations(r):
        cost=0
        for j in range(len(i)-1):
                
                cost+= all_cost[i[j]-1][i[j+1]-1]
       
        max_count=min(max_count,cost)


#			max_count=min(max_count,all_cost[i-a-1][j-a-1]+all_cost[j-a-1][j-a-1])


print(max_count)