import java.util.*
import java.util.Collections.min


fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var N: Long
    N = sc.nextLong()
    var M: Long
    M = sc.nextLong()
    var R: Long
    R = sc.nextLong()
    val r = Array((R).toInt()){0L}
    for (i in 0 until R) {
        r[(i).toInt()] = sc.nextLong()
    }
    val A = Array((M).toInt()){0L}
    val B = Array((M).toInt()){0L}
    val C = Array((M).toInt()){0L}
    for (i in 0 until M) {
        A[(i).toInt()] = sc.nextLong()
        B[(i).toInt()] = sc.nextLong()
        C[(i).toInt()] = sc.nextLong()
    }
    solve1(N, M, R, r, A, B, C)
}

const val INF = (1e15).toLong()

fun solve1(N: Long, M: Long, R: Long, r: Array<Long>, A: Array<Long>, B: Array<Long>, C: Array<Long>) {
    val mat = Array(N.toInt()) { Array(N.toInt()) { INF } }

    for (i in mat.indices) {
        mat[i][i] = 0
    }

    for (i in A.indices) {
        val a = A[i].toInt() - 1
        val b = B[i].toInt() - 1
        mat[a][b] = C[i]
        mat[b][a] = C[i]
    }

    for (k in mat.indices) for (i in mat.indices) for(j in mat.indices) {
        mat[i][j] = Math.min(mat[i][j], mat[i][k] + mat[k][j])
    }

    val dp = Array(1 shl R.toInt()) { Array(R.toInt()) { INF } }

    for (i in r.indices) {
        dp[1 shl i][i] = 0
    }

    for (s in 0 until (dp.size - 1)) {
        for (i in r.indices) {
            if ((s shr i) and 1 == 0) {
                continue
            }

            for (j in r.indices) {
                if (i == j) {
                    continue
                }
                val t = s or (1 shl j)
                dp[t][j] = dp[t][j].coerceAtMost(dp[s][i] + mat[r[i].toInt() - 1][r[j].toInt() - 1])
            }
        }
    }

    println(min(dp.last().asList()))
}

