#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
bool Max(T1& a, T2 b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T1, typename T2>
bool Min(T1& a, T2 b) {
  return a > b ? a = b, 1 : 0;
}
struct edge {
  int to, w, id;
};
const int N = 51, inf = 50 * 50 * 50;
vector<edge> g[N];
int eid;
int cnt[N];
map<array<int, 3>, int> memo;
int go(int from, int to, int w, int id, int tot, int front) {
  assert(front <= tot);
  if (tot == 0) return 0;
  auto& ret = memo[{id, tot, front}];
  if (ret) return ret;
  ret += w;
  if (g[to].size() == 1) {
    return ret += go(to, from, w, g[to][0].id, tot - front, tot - front);
  }
  priority_queue<pair<int, pair<int, int>>> q;
  for (int i = 0; i < (g[to].size()); ++i)
    if (g[to][i].to != from) {
      auto& e = g[to][i];
      q.push({go(to, e.to, e.w, e.id, tot, 1), {i, 1}});
    }
  for (int it = 0; it < (front - 1); ++it) {
    auto cur = q.top();
    q.pop();
    int i = cur.second.first, cnt = cur.second.second;
    auto& e = g[to][i];
    q.push({go(to, e.to, e.w, e.id, tot, cnt + 1), {i, cnt + 1}});
  }
  return ret += q.top().first;
}
int getsz(int i, int p) {
  int ret = cnt[i];
  for (auto& e : g[i])
    if (e.to != p) ret += getsz(e.to, i);
  return ret;
}
void solve() {
  int n, u, v, w;
  cin >> n;
  for (int i = 0; i < (n - 1); ++i) {
    cin >> u >> v >> w;
    g[u].push_back({v, w, eid++});
    g[v].push_back({u, w, eid++});
  }
  int s, m;
  cin >> s >> m;
  for (int i = 0; i < (m); ++i) {
    cin >> u;
    cnt[u]++;
  }
  int ans = 50 * 50 * m;
  for (auto& e : g[s]) {
    int sz = getsz(e.to, s);
    Min(ans, go(s, e.to, e.w, e.id, m, sz));
  }
  cout << ans << '\n';
}
void init() {}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  init();
  int TC = 1;
  for (int TI = 1; TI <= (TC); ++TI) {
    solve();
  }
  return 0;
}
