import java.io.{BufferedReader, IOException, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{min, max, abs}

object Main {
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N = sc.nextInt()
    val M = sc.nextInt()
    val R = sc.nextInt()
    val r = Array.fill(R)(sc.nextInt())
    val INF = 100000000
    val e = Array.fill[Int](N, N)(INF)
    (0 until M) foreach { _ =>
      val a = sc.nextInt() - 1
      val b = sc.nextInt() - 1
      val c = sc.nextInt()
      if (e(a)(b) > c) e(a)(b) = c
      if (e(b)(a) > c) e(b)(a) = c
    }

    val d = e.clone()
    for {
      k <- 0 until N
      i <- 0 until N
      j <- 0 until N
    } d(i)(j) = min(d(i)(j), d(i)(k) + d(k)(j))

    val ans = permutation(r, Integer.MAX_VALUE) { (p, ans) =>
      val iterate = (p zip p.drop(1) map { case (i, j) =>
        d(i - 1)(j - 1)
      }).sum
      min(ans, iterate)
    }
    println(ans)
  }

  def main(args: Array[String]): Unit = {
    solve()
  }

  @specialized
  def permutation[A, B](a: Array[A], z: B)(f: (Array[A], B) => B): B = {
    def swap(i: Int, j: Int): Unit = {
      val temp = a(i)
      a(i) = a(j)
      a(j) = temp
    }

    def step(n: Int, acc: B): B = n match {
      case 1 => f(a, acc)
      case _ =>
        val acc2 = (0 until n - 1).foldLeft(acc) { (acc0, i) =>
          val acc1 = step(n - 1, acc0)
          if (n % 2 == 0) {
            swap(i, n - 1)
          } else {
            swap(0, n - 1)
          }
          acc1
        }
        step(n - 1, acc2)
    }

    step(a.length, z)
  }

  class InputReader(val stream: InputStream) {
    val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}
