#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 10000
using namespace std;
typedef long long ll;
typedef pair<int,bool> P;
typedef pair<P,P> PP;

struct UF{
	int par[MAX_N];
	int rank[MAX_N];
    bool piv[MAX_N];

	void init(int n){
		rep(i,n){
			par[i] = i;
			rank[i] = 0;
            piv[i] = false;
		}
	}

	int find(int x){
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
    
    bool canunite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return true;
        if(piv[x] & piv[y]) return false;
        return true;
    }

	void unite(int x, int y, int &z){
		x = find(x);
		y = find(y);
		if(x == y) return;
        
        if(piv[x] & piv[y]) z--;
		
		if(rank[x] < rank[y]){
			par[x] = y;
            piv[y] |= piv[x];
		} else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
            piv[x] |= piv[y];
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
} uf;

int n, t, k;
int ans;
struct edge{
    int w, a, b;
    bool operator>( const edge& right) const {
        return w > right.w;
    }
} e[10000];

void solve(){
    uf.init(n);
    ans = 0;
    rep(i,n-1){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        e[i].w = c; e[i].a = a; e[i].b = b;
    }
    sort(e,e+n-1,greater<edge>());
    rep(i,t){
        int a; cin >> a;
        a--;
        uf.piv[a] = true;
    }
    rep(i,n-1){
        if(t-1 == k){
            if(!uf.canunite(e[i].a,e[i].b)){
                ans += e[i].w;
            } else{
                uf.unite(e[i].a,e[i].b,t);
            }
            continue;
        }
        uf.unite(e[i].a,e[i].b,t);
    }
    cout << ans << endl;
}

int main(){
    int i = 1;
    while(cin >> n >> t >> k){
        if(n == 0 && t == 0 && k == 0) break;
        cout << "Case " << i << ": ";
        solve();
        i++;
    }
}