#include <bits/stdc++.h>
//!===========================================================!//
//!  dP     dP                          dP                    !//
//!  88     88                          88                    !//
//!  88aaaaa88a .d8888b. .d8888b. .d888b88 .d8888b. 88d888b.  !//
//!  88     88  88ooood8 88'  `88 88'  `88 88ooood8 88'  `88  !//
//!  88     88  88.  ... 88.  .88 88.  .88 88.  ... 88        !//
//!  dP     dP  `88888P' `88888P8 `88888P8 `88888P' dP        !//
//!===========================================================!//
using ld = long double;
using ll = long long;
std::mt19937 mt{std::random_device{}()};
template <typename F>
constexpr F PI() { return 3.1415926535897932385; }
template <typename T, std::size_t N>
std::ostream& operator<<(std::ostream& os, const std::array<T, N>& v)
{
    os << "[";
    for (const auto& e : v) { os << e << ","; }
    return (os << "]" << std::endl);
}
template <typename T, typename A>
std::ostream& operator<<(std::ostream& os, const std::deque<T, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << e << ","; }
    return (os << "]" << std::endl);
}
template <typename K, typename T, typename C, typename A>
std::ostream& operator<<(std::ostream& os, const std::multimap<K, T, C, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; }
    return (os << "]" << std::endl);
}
template <typename T, typename C, typename A>
std::ostream& operator<<(std::ostream& os, const std::multiset<T, C, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << e << ","; }
    return (os << "]" << std::endl);
}
template <typename K, typename T, typename C, typename A>
std::ostream& operator<<(std::ostream& os, const std::map<K, T, C, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; }
    return (os << "]" << std::endl);
}
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& v) { return (os << "<" << v.first << "," << v.second << ">"); }
template <typename T1, typename T2, typename T3>
std::ostream& operator<<(std::ostream& os, const std::priority_queue<T1, T2, T3>& v)
{
    auto q = v;
    os << "[";
    while (not q.empty()) { os << q.top() << ",", q.pop(); }
    return os << "]\n";
}
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, const std::queue<T1>& v)
{
    auto q = v;
    os << "[";
    while (not q.empty()) { os << q.front() << ",", q.pop(); }
    return os << "]\n";
}
template <typename T, typename C, typename A>
std::ostream& operator<<(std::ostream& os, const std::set<T, C, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << e << ","; }
    return (os << "]" << std::endl);
}
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, const std::stack<T1>& v)
{
    auto q = v;
    os << "[";
    while (not q.empty()) { os << q.top() << ",", q.pop(); }
    return os << "]\n";
}
template <typename K, typename T, typename H, typename P, typename A>
std::ostream& operator<<(std::ostream& os, const std::unordered_multimap<K, T, H, P, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; }
    return (os << "]" << std::endl);
}
template <typename T, typename H, typename P, typename A>
std::ostream& operator<<(std::ostream& os, const std::unordered_multiset<T, H, P, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << e << ","; }
    return (os << "]" << std::endl);
}
template <typename K, typename T, typename H, typename P, typename A>
std::ostream& operator<<(std::ostream& os, const std::unordered_map<K, T, H, P, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << "<" << e.first << ": " << e.second << ">,"; }
    return (os << "]" << std::endl);
}
template <typename T, typename H, typename P, typename A>
std::ostream& operator<<(std::ostream& os, const std::unordered_set<T, H, P, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << e << ","; }
    return (os << "]" << std::endl);
}
template <typename T, typename A>
std::ostream& operator<<(std::ostream& os, const std::vector<T, A>& v)
{
    os << "[";
    for (const auto& e : v) { os << e << ","; }
    return (os << "]" << std::endl);
}
#define show(x) std::cerr << #x << " = " << (x) << std::endl
//!============================================!//
//!    8888ba.88ba             oo              !//
//!    88  `8b  `8b                            !//
//!    88   88   88  .d8888b.  dP  88d888b.    !//
//!    88   88   88  88'  `88  88  88'  `88    !//
//!    88   88   88  88.  .88  88  88    88    !//
//!    dP   dP   dP  `88888P8  dP  dP    dP    !//
//!============================================!//
int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    for (int N, T, K, cnt = 1;; cnt++) {
        std::cin >> N >> T >> K;
        if (N == 0 and T == 0 and K == 0) { break; }
        using P = std::pair<int, int>;
        using PP = std::pair<int, P>;
        std::vector<std::vector<PP>> g(N);
        for (int i = 0, u, v, c; i < N - 1; i++) { std::cin >> u >> v >> c, u--, v--, g[u].push_back({c, {u, v}}), g[v].push_back({c, {v, u}}); }
        std::vector<int> ruined(N, -1);
        std::priority_queue<PP> Q;
        for (int i = 0, p; i < T; i++) {
            std::cin >> p, p--, ruined[p] = p;
            for (const auto& pp : g[p]) { Q.push(pp); }
        }
        std::vector<PP> Q2;
        while (not Q.empty()) {
            const auto pp = Q.top();
            Q.pop();
            const int c = pp.first, u = pp.second.first, v = pp.second.second;
            if (ruined[u] == ruined[v]) { continue; }
            if (ruined[v] != -1) {
                Q2.push_back({c, std::minmax(u, v)});
            } else {
                ruined[v] = ruined[u];
                for (const auto& pp : g[v]) {
                    if (ruined[v] == ruined[pp.second.second]) { continue; }
                    Q.push(pp);
                }
            }
        }
        std::sort(Q2.begin(), Q2.end());
        Q2.erase(std::unique(Q2.begin(), Q2.end()), Q2.end());
        int ans = 0;
        for (int i = 0; i < K; i++) { ans += Q2[i].first; }
        std::cout << "Case " << cnt << ": " << ans << "\n";
    }

    return 0;
}



Measured memory_bytes: 4468