import core.bitop;
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
  auto f = readln.chomp.split.map!(to!int).array;
  int n = f[0];
  int m = f[1];
  int r = f[2];
  int[int] trg;
  foreach (int i, t; readln.chomp.split.map!(to!int).array)
  {
    trg[t - 1] = i;
  }
  long[][] d = new long[][](n, n);
  foreach (ref a; d)
  {
    a[] = 1L << 60;
  }
  foreach (i; 0 .. m)
  {
    auto l = readln.chomp.split.map!(to!int);
    int a = l[0] - 1;
    int b = l[1] - 1;
    long c = l[2];
    d[a][b] = d[b][a] = c;
  }
  foreach (k; 0 .. n)
  {
    foreach (i; 0 .. n)
    {
      foreach (j; 0 .. n)
      {
        if (d[i][j] > d[i][k] + d[k][j]) {
          d[i][j] = d[i][k] + d[k][j];
        }
      }
    }
  }
  long ans = 1L << 60;
  foreach (k, v; trg)
  {
    bool[][] done = new bool[][](n, 1 << r);
    alias Node = Tuple!(int, "now", int, "bits", long, "cost");
    alias RBT = RedBlackTree!(Node, (l, r) => l.cost < r.cost, true);
    RBT queue = new RBT();
    queue.insert(Node(k, 1 << v, 0));
    while (queue.length)
    {
      Node node = queue.front;
      queue.removeFront;
      if (done[node.now][node.bits])
      {
        continue;
      }
      done[node.now][node.bits] = true;
      if (node.bits == (1 << r) - 1)
      {
        ans = min(ans, node.cost);
        break;
      }
      foreach (to, bit; trg)
      {
        queue.insert(Node(to, node.bits | 1 << bit, node.cost + d[node.now][to]));
      }
    }
  }
  ans.writeln;
}
