#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

int main(){
  cin.tie(0); ios::sync_with_stdio(0);

  int n,t,k,case_num = 0;
  while(cin >> n >> t >> k, n){
    case_num++;

    map<int,int> costs;
    vector< vector<pii> > tree(n);

    for(int i=0;i<n-1;i++){
      int a,b,c;
      cin >> a >> b >> c;
      a--; b--;
      tree[a].push_back(pii(c,b));
      tree[b].push_back(pii(c,a));
      costs[c]++;
    }

    vector<int> base(t), use(n,0);
    for(int i=0;i<t;i++){
      cin >> base[i];
      base[i]--;
      use[base[i]] = 1;
    }

    priority_queue<pii> q;
    for(int v : base){
      for(pii u : tree[v]){
	if(!use[u.second])q.push(u);
      }
    }

    while(q.size()){
      pii p = q.top(); q.pop();
      if(use[p.second])continue;
      use[p.second] = 1;
      costs[p.first]--;

      for(pii u : tree[p.second]){
	if(!use[u.second])q.push(u);
      }
    }

    long long res = 0;
    auto it = costs.begin();
    while(k){
      while(k && it->second){
	it->second--; k--;
	res += it->first;
      }
      it++;
    }
    cout << "Case " << case_num << ": " << res << endl;
  }
}