using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N, R;
    long[,] D;
    long ans = long.MaxValue;
    int[] E;
    void solve()
    {
        N = cin.nextint;
        int M = cin.nextint;
        R = cin.nextint;
        E = cin.scanint.Select(i => i - 1).ToArray();
        D = new long[N, N];
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                D[i, j] = long.MaxValue / 3;
            }
        }
        for (int i = 0; i < M; i++)
        {
            int a = cin.nextint - 1;
            int b = cin.nextint - 1;
            int c = cin.nextint;
            D[a, b] = c;
            D[b, a] = c;
        }
        for (int i = 0; i < N; i++)
        {
            D[i, i] = 0;
        }
        for (int k = 0; k < N; k++)
        {
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    D[i, j] = Math.Min(D[i, j], D[i, k] + D[k, j]);
                }
            }
        }
        //for (int i = 0; i < N; i++)
        //{
        //    for (int j = 0; j < N; j++)
        //    {
        //        Write(" " + D[i, j]);
        //    }
        //    WriteLine();
        //}

        //var Q = new Queue<int>();
        //var S = new Queue<long>();
        //var B = new Queue<int>();
        //while (Q.Any())
        //{

        //}

        calc(0, 0, -1);
        WriteLine(ans);
    }
    void calc(int road, long sum, int before)
    {
        //WriteLine(int.Parse(Convert.ToString(road, 2)).ToString("D3"));
        //Write(before + " ");
        if (road == (1 << R) - 1)
        {
            ans = Math.Min(ans, sum);
            return;
        }
        for (int i = 0; i < R; i++)
        {
            if (before == -1)
            {
                calc(road | 1 << i, 0, i);
            }
            else
            {
                if ((road >> i & 1) == 1) continue;
                //WriteLine(road);
                calc(road | 1 << i, sum + D[E[i], E[before]], i);
            }
   
        }
    }


}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 15580