
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let read_ints n = Array.init n (fun _ -> read_int ())

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f
let rec for_iter_ a b f = if a >= b then () else (f a; for_iter_ (a+1) b f)

let rec pow2 n = if n <= 0 then 1 else 2 * pow2 (n-1)

let inf = 202020202020

let () =
  let [|n; m; r|] = read_ints 3 in
  let rs = read_ints r |> Array.map (fun x -> x - 1) in
  let graph = Array.init n @@ fun _ -> Array.make n inf in
  for_iter_ 0 m (fun _ ->
    let [|a; b; c|] = read_ints 3 in
    graph.(a-1).(b-1) <- c;
    graph.(b-1).(a-1) <- c);

  for_iter_ 0 n (fun i -> graph.(i).(i) <- 0);
  for_iter_ 0 n (fun l -> for_iter_ 0 n @@ fun j -> for_iter_ 0 n @@ fun k ->
    graph.(j).(k) <- min graph.(j).(k) @@ graph.(j).(l) + graph.(l).(k));

  let rgraph = Array.init r @@ fun _ -> Array.make r inf in
  for_iter_ 0 r (fun j ->
    for_iter_ 0 r (fun k -> rgraph.(j).(k) <- graph.(rs.(j)).(rs.(k))));

  let lim = pow2 r in
  let memo = Array.init r @@ fun _ -> Array.make lim inf in
  for_iter_ 0 r (fun j -> memo.(j).(pow2 j) <- 0);

  for_iter_ 0 lim (fun n ->
    for_iter_ 0 r (fun j ->
      if n land pow2 j > 0 then
        let n' = n lxor pow2 j in
        for_iter_ 0 r (fun k ->
          let b = pow2 k in
          if n' land b > 0 then
            memo.(j).(n) <- min memo.(j).(n) (memo.(k).(n') + rgraph.(k).(j)))));

  for_iter 0 r (fun i -> memo.(i).(lim - 1))
  |> List.fold_left min inf
  |> printf "%d\n"
