package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

var abc [200][200]int

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	m := getNextInt(scanner)
	r := getNextInt(scanner)

	rr := make([]int, r)
	for i := 0; i < r; i++ {
		rr[i] = getNextInt(scanner) - 1
	}

	for ir := 0; ir < n; ir++ {
		for il := 0; il < n; il++ {
			if il == ir {
				continue
			}
			abc[il][ir] = int(1e9 + 1)
		}
	}
	for i := 0; i < m; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		c := getNextInt(scanner)
		abc[a][b] = c
		abc[b][a] = c
	}
	ans := solve(n, m, r, rr)

	fmt.Fprintln(writer, ans)

	writer.Flush()
}

func solve(n, m, r int, rr []int) int {
	ans := 0
	for im := 0; im < n; im++ {
		for ir := 0; ir < n; ir++ {
			for il := 0; il < n; il++ {
				if abc[il][ir] > abc[il][im]+abc[im][ir] {
					abc[il][ir] = abc[il][im] + abc[im][ir]
				}
			}
		}
	}

	ans = rec(uint64(0), r, rr)

	return ans
}

func rec(path uint64, r int, rr []int) int {
	mask := uint64(0x1f)
	ans := 0
	n := len(rr)
	width := 5
	if r == 0 {
		for i := 0; i < n-1; i++ {
			if (rightShift(path, i, width) & mask) == 0 {
				continue
			}
			if (rightShift(path, i+1, width) & mask) == 0 {
				continue
			}
			ans += abc[rr[(rightShift(path, i, width)&mask)-1]][rr[(rightShift(path, i+1, width)&mask)-1]]
		}
		return ans
	}

	min := int(1e9 + 1)
	for i := 0; i < n; i++ {
		if (rightShift(path, i, width) & mask) > 0 {
			continue
		}
		a := rec(path|leftShift(uint64(r), i, width), r-1, rr)
		if min > a {
			min = a
		}
	}
	ans = min

	return ans
}

func leftShift(n uint64, i, width int) uint64 {
	return n << uint(i*width)
}
func rightShift(n uint64, i, width int) uint64 {
	return n >> uint(i*width)
}
