Problem: You are given a tree (a connected non-oriented graph without cycles) with vertices numbered from 1 to n, and the length of the i-th edge is wi. In the vertex s there is a policeman, in the vertices x1, x2, ..., xm (xj ≠ s) m criminals are located.

The policeman can walk along the edges with speed 1, the criminals can move with arbitrary large speed. If a criminal at some moment is at the same point as the policeman, he instantly gets caught by the policeman. Determine the time needed for the policeman to catch all criminals, assuming everybody behaves optimally (i.e. the criminals maximize that time, the policeman minimizes that time). Everybody knows positions of everybody else at any moment of time.

Input

The first line contains single integer n (1 ≤ n ≤ 50) — the number of vertices in the tree. The next n - 1 lines contain three integers each: ui, vi, wi (1 ≤ ui, vi ≤ n, 1 ≤ wi ≤ 50) denoting edges and their lengths. It is guaranteed that the given graph is a tree.

The next line contains single integer s (1 ≤ s ≤ n) — the number of vertex where the policeman starts.

The next line contains single integer m (1 ≤ m ≤ 50) — the number of criminals. The next line contains m integers x1, x2, ..., xm (1 ≤ xj ≤ n, xj ≠ s) — the number of vertices where the criminals are located. xj are not necessarily distinct.

Output

If the policeman can't catch criminals, print single line "Terrorists win" (without quotes).

Otherwise, print single integer — the time needed to catch all criminals.

Examples

Input

4
1 2 2
1 3 1
1 4 1
2
4
3 1 4 1


Output

8


Input

6
1 2 3
2 3 5
3 4 1
3 5 4
2 6 3
2
3
1 3 5


Output

21

Note

In the first example one of the optimal scenarios is the following. The criminal number 2 moves to vertex 3, the criminal 4 — to vertex 4. The policeman goes to vertex 4 and catches two criminals. After that the criminal number 1 moves to the vertex 2. The policeman goes to vertex 3 and catches criminal 2, then goes to the vertex 2 and catches the remaining criminal.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
clock_t __stt;
inline void TStart() { __stt = clock(); }
inline void TReport() {
  cerr << fixed << setprecision(3) << "\nCurrent Case Taken Time : "
       << (double)(clock() - __stt) / CLOCKS_PER_SEC << "sec\n";
}
template <typename T>
T MIN(T a, T b) {
  return a < b ? a : b;
}
template <typename T>
T MAX(T a, T b) {
  return a > b ? a : b;
}
template <typename T>
T ABS(T a) {
  return a > 0 ? a : (-a);
}
template <typename T>
void UMIN(T &a, T b) {
  if (b < a) a = b;
}
template <typename T>
void UMAX(T &a, T b) {
  if (b > a) a = b;
}
int n, s, m, x[55], dis[55][55], inrt[55], deg[55];
vector<pair<int, int> > adj[55];
void getdis(int s, int v, int f, int d) {
  int i;
  dis[s][v] = dis[v][s] = d;
  for (i = 0; i < (int)adj[v].size(); ++i) {
    int u = adj[v][i].first, w = adj[v][i].second;
    if (u != f) getdis(s, u, v, d + w);
  }
}
void dfs(int v, int f, int d, int s = -1) {
  inrt[v] = s;
  int i;
  for (i = 0; i < (int)adj[v].size(); ++i) {
    int u = adj[v][i].first, w = adj[v][i].second;
    if (u != f) {
      dfs(u, v, d + w, s == -1 ? u : s);
    }
  }
}
int dp[55][55];
int trans(vector<int> ds, vector<int> is, int pos, int cnm, int ocnm) {
  int i, j, k, cnt = (int)ds.size(), ret = 0;
  for (i = 0; i < cnt; ++i) {
    if (is[i] == pos) continue;
    int low = 1, high = cnm, mid;
    while (low < high) {
      mid = (low + high) / 2;
      int sum = mid, bnd = ds[i] + dp[is[i]][ocnm + cnm - mid];
      for (j = 0; j < cnt; ++j) {
        if (i == j) continue;
        int d = lower_bound(dp[is[j]], dp[is[j]] + ocnm + cnm, bnd - ds[j]) -
                dp[is[j]];
        sum += ocnm + cnm - d;
      }
      if (sum < cnm)
        low = mid + 1;
      else
        high = mid;
    }
    UMAX(ret, dp[is[i]][cnm + ocnm - low] + ds[i]);
  }
  return ret;
}
int main() {
  int i, j, k;
  scanf("%d", &n);
  for (i = 0; i < n - 1; ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    --u;
    --v;
    adj[u].push_back(make_pair(v, w));
    adj[v].push_back(make_pair(u, w));
    ++deg[u];
    ++deg[v];
  }
  scanf("%d%d", &s, &m);
  --s;
  for (i = 0; i < m; ++i) {
    scanf("%d", x + i);
    --x[i];
  }
  dfs(s, -1, 0);
  for (i = 0; i < n; ++i) getdis(i, i, -1, 0);
  for (j = 1; j <= m; ++j) {
    for (i = 0; i < n; ++i) {
      if (deg[i] != 1) continue;
      vector<int> ds, is;
      for (k = 0; k < n; ++k) {
        if (deg[k] == 1 && k != i) {
          ds.push_back(dis[i][k]);
          is.push_back(k);
        }
      }
      dp[i][j] = trans(ds, is, i, j, 0);
    }
  }
  int res = 2000000000;
  for (i = 0; i < (int)adj[s].size(); ++i) {
    int v = adj[s][i].first, w = adj[s][i].second, cnm = 0, gg = 0;
    for (j = 0; j < m; ++j) {
      cnm += (int)(inrt[x[j]] == v);
      if (x[j] == s) ++gg;
    }
    vector<int> ds, is;
    for (j = 0; j < n; ++j) {
      if (j != s && deg[j] == 1 && inrt[j] == v) {
        ds.push_back(dis[j][s]);
        is.push_back(j);
      }
    }
    if (cnm) UMIN(res, trans(ds, is, s, cnm, m - cnm - gg));
  }
  printf("%d\n", res);
  return 0;
}