#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MOD2 = 1007681537;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-12;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return val < a ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline int sign(long double x) { return x < -EPS ? -1 : x > +EPS; }
inline int sign(long double x, long double y) { return sign(x - y); }
const int maxn = 50 + 5;
int n, s;
int a[maxn];
vector<pair<int, int> > adj[maxn];
int size[maxn];
int d[maxn][maxn];
int dp[maxn][maxn][maxn][maxn];
void dfs(int u, int p) {
  size[u] = a[u];
  for (int i = (0); i < (int((adj[u]).size())); i++) {
    int v = adj[u][i].first;
    if (v != p) {
      dfs(v, u);
      size[u] += size[v];
    }
  }
}
int calc(int u, int p, int t1, int t2) {
  if (p == n) t1 += t2, t2 = 0;
  int& res = dp[u][p][t1][t2];
  if (~res) return res;
  res = INF;
  vector<pair<pair<int, int>, int> > vals;
  vector<int> fmn(n, 0), fmx(n, 0);
  for (int v = (0); v < (n); v++)
    if (v != u && v != p && int((adj[v]).size()) == 1 &&
        (p == n || d[p][u] + d[u][v] == d[p][v])) {
      for (int tt = (1); tt < (t1 + 1); tt++) {
        vals.push_back(make_pair(
            make_pair(calc(v, u, tt, t2 + t1 - tt) + d[u][v], tt), v));
      }
    }
  if (!int((vals).size())) {
    if (!t2) return res = 0;
    return res = calc(u, n, t2, 0);
  }
  sort((vals).begin(), (vals).end()), reverse((vals).begin(), (vals).end());
  int totmn = 0, totmx = 0;
  for (int i = (0); i < (int((vals).size())); i++) {
    int v = vals[i].second;
    int tt = vals[i].first.second;
    totmn -= fmn[v];
    totmx -= fmx[v];
    if (!fmn[v])
      fmn[v] = tt;
    else
      chkmin(fmn[v], tt);
    if (!fmx[v])
      fmx[v] = tt;
    else
      chkmax(fmx[v], tt);
    if (fmn[v] == 1) fmn[v] = 0;
    totmn += fmn[v];
    totmx += fmx[v];
    if (totmn <= t1 && t1 <= totmx) {
      return res = vals[i].first.first;
    }
  }
  return res;
}
void solve() {
  cin >> n;
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (n); j++) d[i][j] = i == j ? 0 : INF;
  for (int i = (0); i < (n - 1); i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    chkmin(d[u][v], w);
    chkmin(d[v][u], w);
    adj[u].push_back(make_pair(v, w));
    adj[v].push_back(make_pair(u, w));
  }
  for (int k = (0); k < (n); k++)
    for (int i = (0); i < (n); i++)
      for (int j = (0); j < (n); j++) chkmin(d[i][j], d[i][k] + d[k][j]);
  cin >> s;
  s--;
  int m;
  cin >> m;
  for (int i = (0); i < (m); i++) {
    int x;
    cin >> x;
    x--;
    a[x]++;
  }
  dfs(s, -1);
  memset(dp, -1, sizeof(dp));
  int res = INF;
  for (int i = (0); i < (int((adj[s]).size())); i++) {
    int u = adj[s][i].first;
    int w = adj[s][i].second;
    if (size[u]) {
      chkmin(res, calc(u, s, size[u], m - size[u]) + w);
    }
  }
  cout << res << "\n";
}
int main() {
  int JUDGE_ONLINE = 1;
  if (fopen("in.txt", "r")) {
    JUDGE_ONLINE = 0;
    assert(freopen("in.txt", "r", stdin));
  } else {
    ios_base::sync_with_stdio(0), cin.tie(0);
  }
  solve();
  if (!JUDGE_ONLINE) {
  }
  return 0;
}
