#include <bits/stdc++.h>
using namespace std;
const int mo = 1e9 + 7;
int f[60][60][60][60], siz[60], ans, n, i, j, k, l, x, y, z, S, m;
int edgenum, vet[120], cost[120], nxt[120], head[60];
void addedge(int x, int y, int z) {
  edgenum++;
  vet[edgenum] = y;
  cost[edgenum] = z;
  nxt[edgenum] = head[x];
  head[x] = edgenum;
}
int dfs(int pp, int y, int cnt, int tot, int z) {
  if (!tot) return 0;
  if (!cnt) return 1e9;
  int &F = f[pp][y][cnt][tot];
  int i, j, k, ts = 0;
  if (F != 1e9) return F;
  if (vet[head[pp]] == y && !nxt[head[pp]])
    return F = z + dfs(y, pp, tot - cnt, tot - cnt, z);
  for (int p = head[pp]; p; p = nxt[p])
    if (vet[p] != y) {
      for (i = 0; i <= cnt; i++) dfs(vet[p], pp, i, tot, cost[p]);
      ts++;
    }
  int g[60][60];
  for (i = 0; i <= ts; i++)
    for (j = 0; j <= tot; j++) g[i][j] = 0;
  ts = 0;
  g[0][0] = 1e9;
  for (int p = head[pp]; p; p = nxt[p])
    if (vet[p] != y) {
      ++ts;
      for (j = 0; j <= tot; j++)
        for (k = 0; k <= tot - j; k++)
          g[ts][j + k] =
              max(g[ts][j + k],
                  min(g[ts - 1][j], dfs(vet[p], pp, k, tot, cost[p])));
    }
  return F = g[ts][cnt] + z;
}
void thr(int pp, int y) {
  for (int p = head[pp]; p; p = nxt[p])
    if (vet[p] != y) {
      thr(vet[p], pp);
      siz[pp] += siz[vet[p]];
    }
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n - 1; i++) {
    scanf("%d %d %d", &x, &y, &z);
    addedge(x, y, z);
    addedge(y, x, z);
  }
  scanf("%d %d", &S, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d", &x);
    siz[x]++;
  }
  thr(S, 0);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      for (k = 0; k <= m; k++)
        for (l = 0; l <= m; l++) f[i][j][k][l] = 1e9;
  ans = 1e9;
  for (int p = head[S]; p; p = nxt[p])
    ans = min(ans, dfs(vet[p], S, siz[vet[p]], m, cost[p]));
  printf("%d\n", ans);
}
