#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;
}
const int N = 51, inf = 50 * 50 * 50;
vector<int> g[N];
int cnt[N];
int d[N][N];
int f[N][N];
priority_queue<pair<int, pair<int, int>>> q;
int s, m;
int dfs(int i, int p) {
  int ret = cnt[i];
  if (g[i].size() == 1) {
    q.push({d[s][i] + f[i][m - 1], {i, m - 1}});
    return ret;
  }
  for (auto& e : g[i])
    if (e != p) ret += dfs(e, i);
  return ret;
}
void solve() {
  int n, u, v, w;
  cin >> n;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j) d[i][j] = inf;
  for (int i = 0; i < (n - 1); ++i) {
    cin >> u >> v >> w;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
    d[u][v] = d[v][u] = w;
  }
  for (int k = 0; k < (n); ++k)
    for (int i = 0; i < (n); ++i)
      for (int j = 0; j < (n); ++j) Min(d[i][j], d[i][k] + d[k][j]);
  cin >> s >> m;
  s--;
  for (int i = 0; i < (m); ++i) {
    cin >> u;
    cnt[--u]++;
  }
  for (int k = 1; k <= (m); ++k) {
    for (int i = 0; i < (n); ++i)
      if (g[i].size() == 1) {
        q = priority_queue<pair<int, pair<int, int>>>();
        for (int j = 0; j < (n); ++j)
          if (g[j].size() == 1 && j != i) {
            q.push({d[i][j] + f[j][k - 1], {j, k - 1}});
          }
        for (int it = 0; it < (k - 1); ++it) {
          auto cur = q.top();
          q.pop();
          int j = cur.second.first, k2 = cur.second.second - 1;
          q.push({d[i][j] + f[j][k2], {j, k2}});
        }
        f[i][k] = q.top().first;
      }
  }
  int ans = 50 * 50 * m;
  for (auto& e : g[s]) {
    q = priority_queue<pair<int, pair<int, int>>>();
    int k = dfs(e, s);
    if (!k) continue;
    for (int it = 0; it < (k - 1); ++it) {
      auto cur = q.top();
      q.pop();
      int j = cur.second.first, k2 = cur.second.second - 1;
      q.push({d[s][j] + f[j][k2], {j, k2}});
    }
    Min(ans, q.top().first);
  }
  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;
}
