import java.math.*

val INF = 1000000000
val d = Array(200) { IntArray(200) { INF } }

fun main(args: Array<String>) {
    val (N, M, R) = readInputLine().split(" ").map { it.toInt() }
    
    val rs = readInputLine().split(" ").map { it.toInt() - 1 }.toIntArray()

    for (i in 0 until N) {
        d[i][i] = 0
    }
    
    for (i in 1..M) {
        val (A, B, C) = readInputLine().split(" ").map { it.toInt() }
        d[A - 1][B - 1] = C
        d[B - 1][A - 1] = C
    }

    for (k in 0 until N) {
        for (i in 0 until N) {
            for (j in 0 until N) {
                d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j])
            }
        }
    }
    
    var RBin = 1
    for (i in 1 until R) {
        RBin = RBin shl 1
        RBin++
    }
    
    var ans = Int.MAX_VALUE
    
    for ((i, r) in rs.withIndex()) {
        ans = Math.min(ans, dfs(rs, RBin, r, 1 shl i, 0))
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}

fun dfs(rs:IntArray, RBin: Int, now: Int, visited: Int, cost: Int): Int {
    if (RBin == visited) {
        return cost
    }
    
    var ret = Int.MAX_VALUE
    
    for ((i, r) in rs.withIndex()) {
        if ((1 shl i) and visited != 0) {
            continue
        }
        
        ret = Math.min(ret, dfs(rs, RBin, r, visited + (1 shl i), cost + d[now][r]))
    }
    
    return ret
}
