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;
  }
  alias A = Tuple!(int, "to", long, "cost");
  A[][] adj = new A[][](n);
  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];
    adj[a] ~= A(b, c);
    adj[b] ~= A(a, c);
  }
  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, v, trg[v]));
    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 (arrow; adj[node.now]) {
        int next = node.bits;
        if (arrow.to in trg) {
          next |= 1 << trg[arrow.to];
        }
        queue.insert(Node(arrow.to, next, node.cost + arrow.cost));
      }
    }
  }
  ans.writeln;
}
