using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, M, R) = Slice3<long>();
            ri = Sarray().Select(r => --r).ToArray();
            graph = new long[N, N];
            for (var i = 0; i < N; ++i)
            {
                for (var j = 0; j < N; ++j)
                    graph[i, j] = long.MaxValue / 2;
                graph[i, i] = 0;
            }

            for (var i = 0; i < M; ++i)
            {
                var (a, b, c) = Slice3<long>();
                --a; --b;
                graph[a, b] = c;
                graph[b, a] = c;
            }
            for (var k = 0; k < N; ++k)
                for (var i = 0; i < N; ++i)
                    for (var j = 0; j < N; ++j)
                        if (graph[i, k] + graph[k, j] < graph[i, j])
                            graph[i, j] = graph[i, k] + graph[k, j];
            var ans = long.MaxValue / 2;
            used = new bool[R];
            for (var i = 0; i < R; ++i)
            {
                used[i] = true;
                ans = Min(ans, dfs(ri[i], 0));
                used[i] = false;
            }
            WriteLine(ans);
        }
        static long[] ri;
        static long[,] graph;
        static bool[] used;
        public static long dfs(long root, long dst)
        {
            if (used.All(u => u))
                return dst;
            var R = used.Length;
            var ret = long.MaxValue / 2;
            for (var i = 0; i < R; ++i)
            {
                if (used[i]) continue;
                used[i] = true;
                var t = dfs(ri[i], dst + graph[root, ri[i]]);
                ret = Min(ret, t);
                used[i] = false;
            }
            return ret;
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 36996