use std::vec::Vec;
use std::cmp::*;

pub trait LexicalPermutation {
    /// Return `true` if the slice was permuted, `false` if it is already
    /// at the last ordered permutation.
    fn next_permutation(&mut self) -> bool;
    /// Return `true` if the slice was permuted, `false` if it is already
    /// at the first ordered permutation.
    fn prev_permutation(&mut self) -> bool;
}

impl<T> LexicalPermutation for [T] where T: Ord {
    /// Original author in Rust: Thomas Backman <serenity@exscape.org>
    fn next_permutation(&mut self) -> bool {
        // These cases only have 1 permutation each, so we can't do anything.
        if self.len() < 2 { return false; }

        // Step 1: Identify the longest, rightmost weakly decreasing part of the vector
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] >= self[i] {
            i -= 1;
        }

        // If that is the entire vector, this is the last-ordered permutation.
        if i == 0 {
            return false;
        }

        // Step 2: Find the rightmost element larger than the pivot (i-1)
        let mut j = self.len() - 1;
        while j >= i && self[j] <= self[i-1]  {
            j -= 1;
        }

        // Step 3: Swap that element with the pivot
        self.swap(j, i-1);

        // Step 4: Reverse the (previously) weakly decreasing part
        self[i..].reverse();

        true
    }

    fn prev_permutation(&mut self) -> bool {
        // These cases only have 1 permutation each, so we can't do anything.
        if self.len() < 2 { return false; }

        // Step 1: Identify the longest, rightmost weakly increasing part of the vector
        let mut i = self.len() - 1;
        while i > 0 && self[i-1] <= self[i] {
            i -= 1;
        }

        // If that is the entire vector, this is the first-ordered permutation.
        if i == 0 {
            return false;
        }

        // Step 2: Reverse the weakly increasing part
        self[i..].reverse();

        // Step 3: Find the rightmost element equal to or bigger than the pivot (i-1)
        let mut j = self.len() - 1;
        while j >= i && self[j-1] < self[i-1]  {
            j -= 1;
        }

        // Step 4: Swap that element with the pivot
        self.swap(i-1, j);

        true
    }

}



fn warshal_floyd(n: usize, v: &Vec<(usize, usize, u64)>, direct: bool) -> Vec<Vec<u64>> {
  let mut dist = vec![vec![std::u64::MAX/2; n]; n];
  // init
  for &(x, y, c) in v {
    dist[x][y] = c;
    if !direct {
      dist[y][x] = c;
    }
  }

  for k in 0..n {
    for i in 0..n {
      for j in 0..n {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  dist
}


fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let (n, m, r) = {
    let v: Vec<usize> = read_vec();
    (v[0], v[1], v[2])
  };

  let mut v: Vec<usize> = read_vec::<usize>().iter().map(|&x| x - 1).collect();
  let mut t: Vec<(usize, usize, u64)> = Vec::new();
  for _ in 0..m {
    let s: Vec<usize> = read_vec();
    t.push((s[0] - 1, s[1] - 1, s[2] as u64));
  }

  v.sort();
  // 各頂点の経路探索
  let dist = warshal_floyd(n, &t, false);

  let mut res = std::u64::MAX;

  while {
    let mut tmp = 0;
    for i in 1..r {
      tmp += dist[v[i-1]][v[i]];
    }
    res = min(res, tmp);
    v.next_permutation()
  } {}

  println!("{}", res);

}


Measured memory_bytes: 4352