# coding: utf-8

# Your code here!



from heapq import heappush, heappop

def dijkstra(g,start): #g: 隣接リスト

    inf = float("inf")

    dist = [inf]*(len(g))

    q = [(start,0)] #(点、そこまでの距離)

    dist[start] = 0

    while q:

        v,c = heappop(q)

        if dist[v] < c: continue

        for to, cost in g[v]:

            if dist[v] + cost < dist[to]:

                dist[to] = dist[v] + cost

                heappush(q, (to, dist[to]))

    return dist





n,m,R = [int(i) for i in input().split()]

r = [int(i)-1 for i in input().split()]



inf = 10**9

g = [[] for _ in range(n)]

for _ in range(m):

    a,b,c = [int(i) for i in input().split()]

    g[a-1].append((b-1, c))

    g[b-1].append((a-1, c))





dvec = [None]*R

for i, ri in enumerate(r):

    dvec[i] = dijkstra(g, ri)



m = {ri:i for i, ri in enumerate(r)}    



ans = inf

import itertools

for x in itertools.permutations(r):

    c = 0

    for i, xi in enumerate(x):

        if i > 0:

            c += dvec[m[xi]][x[i-1]]

    if c < ans:

        ans = c

            

print(ans)

























# coding: utf-8

# Your code here!





"""

Dijkstra法: 単一始点最短路（距離が正）

g: g[i] = [(子、距離),...]の隣接リスト

start: 始点

"""

from heapq import heappush, heappop

def dijkstra(g,start): #g: 隣接リスト

    dist = [1e18]*(len(g)) #初期化

    q = [(0,start)] #(そこまでの距離、点)

    dist[start] = 0

    pending = len(g)-1

    while q and pending:

        c,v = heappop(q)

        if dist[v] < c: continue

        pending -= 1

        for to, cost in g[v]:

            if dist[v] + cost < dist[to]:

                dist[to] = dist[v] + cost

                heappush(q, (dist[to], to))

    return dist





n,m,R = [int(i) for i in input().split()]

r = [int(i)-1 for i in input().split()]



inf = 10**9

g = [[] for _ in range(n)]

for _ in range(m):

    a,b,c = [int(i) for i in input().split()]

    g[a-1].append((b-1, c))

    g[b-1].append((a-1, c))





dvec = [None]*R

for i, ri in enumerate(r):

    dvec[i] = dijkstra(g, ri)



m = {ri:i for i, ri in enumerate(r)}    



ans = inf

import itertools

for x in itertools.permutations(r):

    c = 0

    for i, xi in enumerate(x):

        if i > 0:

            c += dvec[m[xi]][x[i-1]]

    if c < ans:

        ans = c

            

print(ans)

























# coding: utf-8
# Your code here!
from heapq import heappush, heappop


def dijkstra(g, start):  # g: 隣接リスト
    inf = float("inf")
    dist = [inf] * (len(g))
    q = [(start, 0)]  # (点、そこまでの距離)
    dist[start] = 0
    while q:
        v, c = heappop(q)
        if dist[v] < c:
            continue
        for to, cost in g[v]:
            if dist[v] + cost < dist[to]:
                dist[to] = dist[v] + cost
                heappush(q, (to, dist[to]))
    return dist


n, m, R = [int(i) for i in input().split()]
r = [int(i) - 1 for i in input().split()]
inf = 10**9
g = [[] for _ in range(n)]
for _ in range(m):
    a, b, c = [int(i) for i in input().split()]
    g[a - 1].append((b - 1, c))
    g[b - 1].append((a - 1, c))
dvec = [None] * R
for i, ri in enumerate(r):
    dvec[i] = dijkstra(g, ri)
m = {ri: i for i, ri in enumerate(r)}
ans = inf
import itertools

for x in itertools.permutations(r):
    c = 0
    for i, xi in enumerate(x):
        if i > 0:
            c += dvec[m[xi]][x[i - 1]]
    if c < ans:
        ans = c
print(ans)

# coding: utf-8
# Your code here!
"""
Dijkstra法: 単一始点最短路（距離が正）
g: g[i] = [(子、距離),...]の隣接リスト
start: 始点
"""
from heapq import heappush, heappop


def dijkstra(g, start):  # g: 隣接リスト
    dist = [1e18] * (len(g))  # 初期化
    q = [(0, start)]  # (そこまでの距離、点)
    dist[start] = 0
    pending = len(g) - 1
    while q and pending:
        c, v = heappop(q)
        if dist[v] < c:
            continue
        pending -= 1
        for to, cost in g[v]:
            if dist[v] + cost < dist[to]:
                dist[to] = dist[v] + cost
                heappush(q, (dist[to], to))
    return dist


n, m, R = [int(i) for i in input().split()]
r = [int(i) - 1 for i in input().split()]
inf = 10**9
g = [[] for _ in range(n)]
for _ in range(m):
    a, b, c = [int(i) for i in input().split()]
    g[a - 1].append((b - 1, c))
    g[b - 1].append((a - 1, c))
dvec = [None] * R
for i, ri in enumerate(r):
    dvec[i] = dijkstra(g, ri)
m = {ri: i for i, ri in enumerate(r)}
ans = inf
import itertools

for x in itertools.permutations(r):
    c = 0
    for i, xi in enumerate(x):
        if i > 0:
            c += dvec[m[xi]][x[i - 1]]
    if c < ans:
        ans = c
print(ans)

+""" +Dijkstra法: 単一始点最短路（距離が正） +g: g[i] = [(子、距離),...]の隣接リスト +start: 始点 +""" -    inf = float("inf") -    dist = [inf] * (len(g)) -    q = [(start, 0)]  # (点、そこまでの距離) +    dist = [1e18] * (len(g))  # 初期化 +    q = [(0, start)]  # (そこまでの距離、点) -    while q: -        v, c = heappop(q) +    pending = len(g) - 1 +    while q and pending: +        c, v = heappop(q) +        pending -= 1 -                heappush(q, (to, dist[to])) +                heappush(q, (dist[to], to))