#include <bits/stdc++.h>
using namespace std;
int n, s, m;
vector<vector<pair<int, int> > > g;
vector<int> x;
vector<vector<int> > dist, mem;
vector<int> cc;
int ncc;
vector<int> crim;
void comb(vector<int>& a, vector<int> const& b) {
  for (int i = (int)(a).size() - 1; i >= 0; --i) {
    int ai = min(a[i], b[0]);
    for (int j = 0; j < i + 1; ++j) ai = max(ai, min(a[j], b[i - j]));
    a[i] = ai;
  }
}
int solveFromLeaf(int u, int c) {
  if (mem[u][c] != -1) return mem[u][c];
  if (c == 0) return 0;
  vector<int> cmb(c + 1, 0);
  cmb[0] = INT_MAX;
  for (int v = 0; v < n; ++v)
    if (v != u && (int)(g[v]).size() == 1) {
      vector<int> t(c + 1);
      t[0] = INT_MAX;
      for (int i = 1; i <= c; ++i) t[i] = dist[u][v] + solveFromLeaf(v, c - i);
      comb(cmb, t);
    }
  return mem[u][c] = cmb[c];
}
int solve() {
  int res = INT_MAX;
  for (pair<int, int> kv : g[s]) {
    int u, w;
    tie(u, w) = kv;
    int uc = crim[cc[u]];
    if (uc == 0) continue;
    vector<int> cmb(uc + 1, 0);
    cmb[0] = INT_MAX;
    for (int v = 0; v < n; ++v)
      if (cc[v] == cc[u] && (int)(g[v]).size() == 1) {
        vector<int> t(uc + 1);
        t[0] = INT_MAX;
        for (int i = 1; i <= uc; ++i)
          t[i] = dist[s][v] + solveFromLeaf(v, m - i);
        comb(cmb, t);
      }
    res = min(res, cmb[uc]);
  }
  return res;
}
void dfs(int u, int p, int ncc) {
  cc[u] = ncc;
  for (pair<int, int> kv : g[u]) {
    int v, w;
    tie(v, w) = kv;
    if (v == p) continue;
    dfs(v, u, ncc);
  }
}
int main() {
  cin >> n;
  g.assign(n, vector<pair<int, int> >());
  for (int i = 0; i < n - 1; ++i) {
    int u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    g[u].push_back(pair<int, int>(v, w));
    g[v].push_back(pair<int, int>(u, w));
  }
  cin >> s;
  s--;
  cin >> m;
  x.assign(m, 0);
  for (int i = 0; i < m; ++i) cin >> x[i], x[i]--;
  mem.assign(n, vector<int>(m + 1, -1));
  dist.assign(n, vector<int>(n, INT_MAX / 2));
  for (int i = 0; i < n; ++i) dist[i][i] = 0;
  for (int u = 0; u < n; ++u)
    for (pair<int, int> kv : g[u]) {
      int v, w;
      tie(v, w) = kv;
      dist[u][v] = w;
    }
  for (int k = 0; k < n; ++k)
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j)
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
  cc.assign(n, -1);
  ncc = 0;
  for (int i = 0; i < (int)(g[s]).size(); ++i) {
    int v = g[s][i].first;
    dfs(v, s, ncc++);
  }
  crim.assign(ncc, 0);
  for (int i = 0; i < m; ++i) crim[cc[x[i]]]++;
  cout << solve() << endl;
}
