object Main {

  import scala.io.StdIn

  def main(args: Array[String]): Unit = {
    val Array(n, m, r) = StdIn.readLine.split(" ").map(_.toInt)
    val rs = StdIn.readLine.split(" ").map(_.toInt-1)

    val map = Array.fill(n)(Array.fill(n)(Int.MaxValue / 3))
    for (_ <- 1 to m) {
      val Array(a, b, c) = StdIn.readLine.split(" ").map(_.toInt)
      map(a-1)(b-1) = c
      map(b-1)(a-1) = c
    }

    for {
      k <- 0 until n
      i <- 0 until n
      j <- 0 until n
      if map(i)(k) + map(k)(j) < map(i)(j)
    } {
       map(i)(j) = map(i)(k) + map(k)(j)
    }

    println {
      rs
        .permutations
        .map(_.sliding(2).map { case Array(i, j) => map(i)(j) }.sum)
        .min
    }
  }
}