#include <bits/stdc++.h>
using namespace std;
bool home = 1;
signed realMain();
signed main() {
  home = 0;
  if (home) {
    freopen("tony_stark", "r", stdin);
  } else {
    ios::sync_with_stdio(0);
    cin.tie(0);
  }
  realMain();
}
const long long N = 50 + 7;
const long long INF = (long long)1e9;
long long n, m, from[2 * N], to[2 * N], dur[2 * N], start;
long long dp[2 * N][N][N];
vector<long long> g[N];
void add(long long i, long long j, long long take) {
  from[m] = i;
  to[m] = j;
  dur[m] = take;
  g[i].push_back(m);
  m++;
}
long long rec(long long edge, long long total, long long sub) {
  if (total == 0) return 0;
  if (dp[edge][total][sub] != -1) return dp[edge][total][sub];
  if ((long long)g[to[edge]].size() == 1) {
    dp[edge][total][sub] = rec(edge ^ 1, total - sub, total - sub) + dur[edge];
    return dp[edge][total][sub];
  }
  long long sol = INF;
  long long lo = 0, hi = INF;
  bool ok = (edge == 1 && total == 4 && sub == 4);
  while (lo <= hi) {
    long long t = (lo + hi) / 2;
    long long cntmin = 0;
    long long nr = (long long)g[to[edge]].size() - 1;
    for (auto &edge2 : g[to[edge]]) {
      if (edge2 == (edge ^ 1)) continue;
      for (long long need = sub; need >= 1; need--) {
        if (rec(edge2, total, need) > t) {
          cntmin += need;
          break;
        }
      }
    }
    bool castig_eu = (cntmin < sub);
    if (castig_eu) {
      sol = t;
      hi = t - 1;
    } else {
      lo = t + 1;
    }
  }
  sol += dur[edge];
  dp[edge][total][sub] = sol;
  return sol;
}
long long este[N];
long long calc_sub(long long a, long long p = -1) {
  long long sol = este[a];
  for (auto &ind : g[a]) {
    long long b = to[ind];
    if (b != p) sol += calc_sub(b, a);
  }
  return sol;
}
signed realMain() {
  for (long long i = 0; i < 2 * N; i++)
    for (long long j = 0; j < N; j++)
      for (long long k = 0; k < N; k++) dp[i][j][k] = -1;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long x, y, take;
    cin >> x >> y >> take;
    add(x, y, take);
    add(y, x, take);
  }
  cin >> start;
  long long cntnodes;
  cin >> cntnodes;
  vector<long long> nodes(cntnodes);
  for (auto &x : nodes) cin >> x;
  for (auto &x : nodes) este[x]++;
  long long ret = INF;
  for (auto &ind : g[start]) {
    ret = min(ret, rec(ind, (long long)nodes.size(), calc_sub(to[ind], start)));
  }
  cout << ret << "\n";
  return 0;
}
