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

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

#region Library

public interface IMonoid<T>
{
    T Unit { get; }
    T Append(T left, T right);
}

public class Monoid<T> : IMonoid<T>
{
    public T Unit { get; private set; }
    Func<T, T, T> append;
    public T Append(T left, T right) => append(left, right);

    public Monoid(T unit, Func<T, T, T> append)
    {
        this.Unit = unit;
        this.append = append;
    }
}

public abstract class Graph<T> where T : IEquatable<T>
{
    public abstract T this[int source, int target] { get; set; }

    public int V { get; protected set; }
    public IMonoid<T> Monoid { get; protected set; }
    public IMonoid<T> Comparer { get; protected set; }

    public event Action GraphChanged;
    protected void OnGraphChanged() => GraphChanged?.Invoke();

    public bool HasEdge(int source, int target)
        => !this[source, target].Equals(this.Comparer.Unit);
}

public class AdjacencyMatrix<T> : Graph<T> where T : IEquatable<T>
{
    protected readonly T[,] graph;

    public override T this[int source, int target]
    {
        // O(1)
        get { return graph[source, target]; }

        // O(1)
        set
        {
            var a = this.Comparer.Append(graph[source, target], value);
            if (a.Equals(graph[source, target])) return;
            graph[source, target] = a;
            OnGraphChanged();
        }
    }

    // O(V^2)
    public AdjacencyMatrix(int v, IMonoid<T> monoid, IMonoid<T> comparer)
    {
        this.V = v;
        this.Monoid = monoid;
        this.Comparer = comparer;
        graph = new T[v, v];
        for (var i = 0; i < v; i++)
            for (var j = 0; j < v; j++)
                graph[i, j] = i == j ? monoid.Unit : comparer.Unit;
    }
}

public class WarshallFloyd<T> where T : IEquatable<T>
{
    AdjacencyMatrix<T> graph;
    T[,] d;
    bool calculated = false;

    // O(1)
    public WarshallFloyd(AdjacencyMatrix<T> graph)
    {
        this.graph = graph;
        d = new T[graph.V, graph.V];
        graph.GraphChanged += () => calculated = false;
    }

    // O(V^3)
    public void Calculate()
    {
        if (calculated) return;

        for (var i = 0; i < graph.V; i++)
            for (var j = 0; j < graph.V; j++) d[i, j] = graph[i, j];

        for (var k = 0; k < graph.V; k++)
            for (var i = 0; i < graph.V; i++)
                for (var j = 0; j < graph.V; j++)
                    d[i, j] = graph.Comparer.Append(d[i, j],
                        d[i, k].Equals(graph.Comparer.Unit)
                        || d[k, j].Equals(graph.Comparer.Unit)
                        ? graph.Comparer.Unit
                        : graph.Monoid.Append(d[i, k], d[k, j]));

        calculated = true;
    }

    // O(1)
    public T GetMinCost(int source, int target)
    {
        if (!calculated) throw new InvalidOperationException();
        return d[source, target];
    }
}

static class Extentions
{
}

#endregion

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var n = io.I;
        var m = io.I;
        var r = io.I;
        var rs = io.Is(r).Select(x => x - 1).ToArray();

        var gr = new AdjacencyMatrix<int>(n,
            new Monoid<int>(0, (a, b) => a + b),
            new Monoid<int>(int.MaxValue >> 1, Min));

        for (var i = 0; i < m; i++)
        {
            var a = io.I - 1;
            var b = io.I - 1;
            var c = io.I;
            gr[a, b] = gr[b, a] = c;
        }

        var wf = new WarshallFloyd<int>(gr);
        wf.Calculate();

        var visited = new bool[r];

        Func<int, int, int> Search = null; Search = (int i, int s) =>
        {
            if (visited.All(x => x)) return s;

            var t = int.MaxValue;

            for (var j = 0; j < r; j++)
            {
                if (!visited[j])
                {
                    visited[j] = true;
                    t = Min(t, Search(j, s + wf.GetMinCost(rs[i], rs[j])));
                    visited[j] = false;
                }
            }

            return t;
        };

        var ans = int.MaxValue;
        for (var i = 0; i < r; i++) ans = Min(ans, Search(i, 0));

        io.Write(ans);
    }
}

Measured memory_bytes: 21572