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;
int n, m, q;
vector<int> adj[(50 + 1)];
map<pair<int, int>, int> weight;
int dist[(50 + 1)][(50 + 1)];
int dp[(50 + 1)][(50 + 1)];
int pris[(50 + 1)];
vector<int> leaves[(50 + 1)];
int dfs(int curr, int par, int head) {
  int ans = 0;
  int child = 0;
  for (int nxt : adj[curr])
    if (nxt != par) ans += dfs(nxt, curr, head), child++;
  if (child == 0) leaves[head].push_back(curr);
  return pris[curr] + ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y, w;
    cin >> x >> y >> w;
    x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
    weight[{x, y}] = w;
    weight[{y, x}] = w;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (weight.count({i, j}) == 1) {
        dist[i][j] = weight[{i, j}];
        dist[j][i] = weight[{i, j}];
      } else {
        dist[i][j] = 1e9;
        dist[j][i] = 1e9;
      }
  for (int i = 0; i < n; i++) dist[i][i] = 0;
  int s;
  cin >> s;
  s--;
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    pris[x - 1]++;
  }
  for (int k = 0; k < n; k++)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        if (dist[i][j] > (dist[i][k] + dist[k][j])) {
          dist[i][j] = dist[i][k] + dist[k][j];
          dist[j][i] = dist[i][k] + dist[k][j];
        }
      }
  for (int i = 0; i < n; i++) dfs(i, -1, i);
  for (int caught = 1; caught < m + 1; caught++) {
    for (int src = 0; src < n; src++) {
      int L = 0, R = 1e9;
      while (L <= R) {
        int c = caught;
        int COST = (L + R) >> 1;
        for (int nxt : leaves[src]) {
          int used = 0;
          while (used < c &&
                 COST <= (dp[nxt][caught - used - 1] + dist[src][nxt])) {
            used++;
          }
          c -= used;
        }
        if (c == 0) {
          dp[src][caught] = COST;
          L = COST + 1;
        } else
          R = COST - 1;
      }
    }
  }
  if (adj[s].size() == 1) {
    cout << dp[s][m];
    return 0;
  }
  int ans = numeric_limits<int>().max() / 2;
  for (int nxt : adj[s]) {
    int src = nxt;
    leaves[nxt] = vector<int>();
    int c = dfs(nxt, s, nxt);
    int cons = c;
    int L = 0, R = 1e9;
    while (L + 1 < R) {
      int c = cons;
      int COST = (L + R) >> 1;
      for (int nxt : leaves[src]) {
        if (nxt != s) {
          int used = 0;
          while (used < c && COST <= (dp[nxt][m - used - 1] + dist[s][nxt])) {
            used++;
          }
          c -= used;
        }
      }
      if (c == 0) {
        L = COST;
      } else
        R = COST;
    }
    ans = min(ans, L);
  }
  cout << ans;
  return 0;
}