INF = float('inf')



N,M,RR = list(map(int,input().split(" ")))

R = list([int(x)-1 for x in input().split(" ")])

G = [[] for i in range(N)]

sq = [[(x==y)-1 for x in range(RR)] for y in range(RR)]

for i in range(M):

    a,b,c = list(map(int,input().split(" ")))

    a -= 1

    b -= 1

    G[a].append((b,c))

    G[b].append((a,c))



for i in range(RR):

    E = [INF for x in range(N)]

    F = [0 for x in range(N)]

    E[R[i]] = 0

    F[R[i]] = 1

    q = R[i]

    c = 1

    while c != N:

        for a,b in G[q]:

            if F[a]:

                continue

            if E[a] == -1:

                E[a] = E[q] + b

            else:

                E[a] = min(E[a],E[q] + b)

        a = [x for x in range(N) if not(F[x]) and E[x] != -1]

        q = min(a,key=lambda x:E[x])

        F[q] = 1

        c += 1

    for j in range(RR):

        sq[i][j] = E[R[j]]



q = [[[],0,0]]

s = []

while len(q):

    a,b,c = q.pop()

    if b == RR:

        s.append(c)

        continue

    for i in range(RR):

        if i in a:

            continue

        if b == 0:

            q.append([a+[i],b+1,0])

        else:

            q.append([a+[i],b+1,c+sq[a[-1]][i]])



print((min(s)))

INF = float('inf')



N,M,RR = list(map(int,input().split(" ")))

R = list([int(x)-1 for x in input().split(" ")])

G = [[] for i in range(N)]

sq = [[(x==y)-1 for x in range(RR)] for y in range(RR)]

for i in range(M):

    a,b,c = list(map(int,input().split(" ")))

    a -= 1

    b -= 1

    G[a].append((b,c))

    G[b].append((a,c))



for i in range(RR):

    E = [INF]*N

    F = [1]*N

    E[R[i]] = 0

    F[R[i]] = 0

    q = R[i]

    c = 1

    while c != N:

        for a,b in G[q]:

            if F[a]:

                E[a] = min(E[a],E[q] + b)

        a = [x for x in range(N) if F[x]]

        q = min(a,key=lambda x:E[x])

        F[q] = 0

        c += 1

    for j in range(RR):

        sq[i][j] = E[R[j]]



q = [[[],0,0]]

s = []

while len(q):

    a,b,c = q.pop()

    if b == RR:

        s.append(c)

        continue

    for i in range(RR):

        if i in a:

            continue

        d = c

        d += b and sq[a[-1]][i]

        q.append([a+[i],b+1,d])



print((min(s)))

INF = float("inf")
N, M, RR = list(map(int, input().split(" ")))
R = list([int(x) - 1 for x in input().split(" ")])
G = [[] for i in range(N)]
sq = [[(x == y) - 1 for x in range(RR)] for y in range(RR)]
for i in range(M):
    a, b, c = list(map(int, input().split(" ")))
    a -= 1
    b -= 1
    G[a].append((b, c))
    G[b].append((a, c))
for i in range(RR):
    E = [INF for x in range(N)]
    F = [0 for x in range(N)]
    E[R[i]] = 0
    F[R[i]] = 1
    q = R[i]
    c = 1
    while c != N:
        for a, b in G[q]:
            if F[a]:
                continue
            if E[a] == -1:
                E[a] = E[q] + b
            else:
                E[a] = min(E[a], E[q] + b)
        a = [x for x in range(N) if not (F[x]) and E[x] != -1]
        q = min(a, key=lambda x: E[x])
        F[q] = 1
        c += 1
    for j in range(RR):
        sq[i][j] = E[R[j]]
q = [[[], 0, 0]]
s = []
while len(q):
    a, b, c = q.pop()
    if b == RR:
        s.append(c)
        continue
    for i in range(RR):
        if i in a:
            continue
        if b == 0:
            q.append([a + [i], b + 1, 0])
        else:
            q.append([a + [i], b + 1, c + sq[a[-1]][i]])
print((min(s)))

INF = float("inf")
N, M, RR = list(map(int, input().split(" ")))
R = list([int(x) - 1 for x in input().split(" ")])
G = [[] for i in range(N)]
sq = [[(x == y) - 1 for x in range(RR)] for y in range(RR)]
for i in range(M):
    a, b, c = list(map(int, input().split(" ")))
    a -= 1
    b -= 1
    G[a].append((b, c))
    G[b].append((a, c))
for i in range(RR):
    E = [INF] * N
    F = [1] * N
    E[R[i]] = 0
    F[R[i]] = 0
    q = R[i]
    c = 1
    while c != N:
        for a, b in G[q]:
            if F[a]:
                E[a] = min(E[a], E[q] + b)
        a = [x for x in range(N) if F[x]]
        q = min(a, key=lambda x: E[x])
        F[q] = 0
        c += 1
    for j in range(RR):
        sq[i][j] = E[R[j]]
q = [[[], 0, 0]]
s = []
while len(q):
    a, b, c = q.pop()
    if b == RR:
        s.append(c)
        continue
    for i in range(RR):
        if i in a:
            continue
        d = c
        d += b and sq[a[-1]][i]
        q.append([a + [i], b + 1, d])
print((min(s)))

-    E = [INF for x in range(N)] -    F = [0 for x in range(N)] +    E = [INF] * N +    F = [1] * N -    F[R[i]] = 1 +    F[R[i]] = 0 -                continue -            if E[a] == -1: -                E[a] = E[q] + b -            else: -        a = [x for x in range(N) if not (F[x]) and E[x] != -1] +        a = [x for x in range(N) if F[x]] -        F[q] = 1 +        F[q] = 0 -        if b == 0: -            q.append([a + [i], b + 1, 0]) -        else: -            q.append([a + [i], b + 1, c + sq[a[-1]][i]]) +        d = c +        d += b and sq[a[-1]][i] +        q.append([a + [i], b + 1, d])