#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, m, s, vis[N], sz[N];
int dp[N][N][N], deg[N];
int ptr, head[N], v[N], w[N], nxt[N];
void add_edge(int uu, int vv, int ww) {
  v[ptr] = vv;
  w[ptr] = ww;
  nxt[ptr] = head[uu];
  head[uu] = ptr++;
}
void dfs(int pos, int fa) {
  sz[pos] = vis[pos];
  for (int i = head[pos]; i != -1; i = nxt[i])
    if (v[i] != fa) dfs(v[i], pos), sz[pos] += sz[v[i]];
}
int dfs(int e, int tot, int cnt) {
  if (!tot) return 0;
  int &ans = dp[e][tot][cnt];
  if (ans != -1) return ans;
  if (deg[v[e]] == 1) {
    if (tot == cnt) return 0;
    return dfs(e ^ 1, tot - cnt, tot - cnt) + w[e];
  }
  int g[N] = {};
  g[0] = INT_MAX >> 2;
  for (int i = head[v[e]]; i != -1; i = nxt[i]) {
    if (i == (e ^ 1)) continue;
    for (int j = cnt; j > 0; --j)
      for (int k = j; k > 0; --k)
        g[j] = max(g[j], min(g[j - k], dfs(i, tot, k) + w[i]));
  }
  return ans = g[cnt];
}
int main() {
  ios::sync_with_stdio(false);
  int t1, t2, t3;
  memset(head, -1, sizeof(head));
  memset(nxt, -1, sizeof(nxt));
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> t1 >> t2 >> t3;
    ++deg[t1];
    ++deg[t2];
    add_edge(t1, t2, t3);
    add_edge(t2, t1, t3);
  }
  cin >> s >> m;
  for (int i = 1; i <= m; i++) cin >> t1, ++vis[t1];
  dfs(s, 0);
  memset(dp, -1, sizeof(dp));
  int ans = INT_MAX;
  for (int i = head[s]; i != -1; i = nxt[i])
    ans = min(ans, dfs(i, m, sz[v[i]]) + w[i]);
  cout << ans << endl;
  return 0;
}
