#include <bits/stdc++.h>
using namespace std;

//https://github.com/hoget157/library/blob/master/DataStructure/UnionFind.cpp
struct UnionFind{
	vector<int> rnk,par;

	UnionFind(int sz) : rnk(sz,0),par(sz){
		for(int i = 0;i < sz;i++) par[i] = i;
	}

	int find(int x){
		if(par[x] == x) return x;
		return par[x] = find(par[x]);
	}

	void unite(int x,int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(rnk[x] < rnk[y]) swap(x,y);
		par[y] = x;
		if(rnk[x] == rnk[y]) rnk[x]++;
	}
	
	bool same(int x,int y){
		return (find(x) == find(y));
	}
};

struct edge{ int from,to,cost; };

signed main(){
	int n,t,k;
	for(int _t = 0;cin >> n >> t >> k,n;_t++){
		vector<edge> edges;
		UnionFind uf(n);
		int ans = 0;
		for(int i = 0;i < n - 1;i++){
			int a,b,w;
			cin >> a >> b >> w; a--;b--;
			edges.push_back({a,b,w});
			ans += w;
		}
		sort(edges.begin(),edges.end(),[](const edge &e1,const edge &e2){
			return e1.cost > e2.cost;
		});
		int base[10010];
		for(int i = 0;i < t;i++){
			cin >> base[i]; base[i]--;
			if(i) uf.unite(base[i],base[i - 1]);
		}
		int other = 0;
		for(const auto &e : edges){
			if(!uf.same(e.from,e.to)){
				uf.unite(e.from,e.to);
				ans -= e.cost;
			}else{
				if(other < t - k - 1) ans -= e.cost;
				other++;
			}
		}
		printf("Case %d: %d\n",_t + 1,ans);
	}
}
