#include <bits/stdc++.h>
using namespace std;
int a[55][55], d[55], n, st, m, b[55], w, ans = 1e9, t[1200];
int f[55][55][55][55];
void dfs(int x, int fa) {
  for (int i = 1; i <= n; i++)
    if (a[x][i] && i != fa) dfs(i, x), b[x] += b[i];
}
void clear() {
  for (int i = 1; i <= w; i++) t[i] = 0;
}
void ins(int x) {
  int i, j;
  for (i = 1; i <= w; i = i + 1)
    if (x > t[i]) break;
  if (i > w) return;
  for (j = w; j > i; j = j - 1) t[j] = t[j - 1];
  t[i] = x;
}
int solve(int x, int y, int i, int j) {
  if (!i && !j) return 0;
  if (f[x][y][i][j]) return f[x][y][i][j];
  int &g = f[x][y][i][j];
  if (d[y] == 1) return (g = a[x][y] + solve(y, x, j, 0));
  for (int u = 1; u <= n; u++)
    if (a[y][u] && u != x)
      for (int k = 1; k <= i; k++) solve(y, u, k, i + j - k);
  clear();
  for (int u = 1; u <= n; u++)
    if (a[y][u] && u != x)
      for (int k = 1; k <= i; k++) ins(f[y][u][k][i + j - k]);
  g = t[i] + a[x][y];
  return g;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y, c;
    scanf("%d %d %d", &x, &y, &c);
    a[x][y] = a[y][x] = c;
    d[x]++;
    d[y]++;
  }
  scanf("%d %d", &st, &m);
  for (int i = 1; i <= m; i++) {
    int x;
    scanf("%d", &x);
    b[x]++;
  }
  dfs(st, 0);
  w = 100;
  for (int i = 1; i <= n; i++)
    if (a[st][i]) ans = min(ans, solve(st, i, b[i], m - b[i]));
  printf("%d", ans);
}
