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;

alias A = Tuple!(int, "to", long, "cost");

int n, m, r;
A[][] adj;
int[int] trg;
long[][] memo;
bool[][] prev;
bool[][] done;

long dfs(int now, int bits)
{
  if (bits == (1 << r) - 1)
  {
    return 0;
  }
  if (done[now][bits])
  {
    return memo[now][bits];
  }
  long ans = long.max >> 4;
  foreach (A arrow; adj[now])
  {
    int next = bits;
    if (arrow.to in trg)
    {
      next |= 1 << trg[arrow.to];
    }
    if (prev[arrow.to][next])
    {
      continue;
    }
    prev[arrow.to][next] = true;
    ans = min(ans, arrow.cost + dfs(arrow.to, next));
    prev[arrow.to][next] = false;
  }
  done[now][bits] = true;
  memo[now][bits] = ans;
  return ans;
}

void main()
{
  auto f = readln.chomp.split.map!(to!int).array;
  n = f[0];
  m = f[1];
  r = f[2];
  foreach (int i, t; readln.chomp.split.map!(to!int).array)
  {
    trg[t - 1] = i;
  }
  assert(trg.length == r);
  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 = long.max;
  foreach (i; 0 .. n)
  {
    memo = new long[][](n, 1 << r);
    done = new bool[][](n, 1 << r);
    prev = new bool[][](n, 1 << r);
    int bits = 0;
    if (i in trg) {
      bits |= 1 << trg[i];
    } else {
      continue;
    }
    prev[i][bits] = true;
    long ret = dfs(i, bits);
    // stderr.writeln(i, " ", format("%08b", bits), " : ", ret);
    ans = min(ans, ret);
  }
  ans.writeln;
}
