#include <bits/stdc++.h>

using namespace std;

set<int> base;

struct UnionFind {
  vector<int> data;
  UnionFind(int n):data(n, -1){}
  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  void unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return;
    //if(data[x] < data[y]) swap(x, y);
    if(!base.count(x)) swap(x, y);
    data[x] += data[y];
    data[y] = x;
  }
};

struct edge {
  int from, to, cost;
  edge(){}
  edge(int from, int to, int cost):from(from), to(to), cost(cost){}
  bool operator < (const edge& e) const {
    return cost > e.cost;
  }
};

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;

vector<edge> es;

int main() {
  int n, t, k;
  int T = 0;
  while(cin >> n >> t >> k, n || t || k) {
    base.clear();
    es.clear();
    for(int i = 0; i < n-1; i++) {
      int a, b, c;
      cin >> a >> b >> c;
      --a, --b;
      es.emplace_back(a, b, c);
    }
    UnionFind uf(n);
    for(int i = 0; i < t; i++) {
      int d; cin >> d; --d;
      base.insert(d);
    }
    vector<int> ans;
    sort(es.begin(), es.end());
    for(int i = 0; i < n-1; i++) {
      for(edge& e : es) {
	if(!uf.same(e.from, e.to)) {
	  int x = uf.find(e.from), y = uf.find(e.to);
	  if(base.count(x) && base.count(y)) {
	    ans.push_back(e.cost);
	  }
	  uf.unite(x, y);
	}
      }
    }
    sort(ans.begin(), ans.end());
    int total = 0;
    for(int i = 0; i < k; i++) total += ans[i];
    cout << "Case " << ++T << ": " << total << endl;
  }
  return 0;
}