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;
template <typename T1, typename T2>
bool Max(T1& a, T2 b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T1, typename T2>
bool Min(T1& a, T2 b) {
  return a > b ? a = b, 1 : 0;
}
const int N = 51, inf = 50 * 50 * 50;
vector<int> g[N];
int cnt[N];
int d[N][N];
int f[N][N];
priority_queue<pair<int, pair<int, int>>> q;
int s, m;
int dfs(int i, int p) {
  int ret = cnt[i];
  if (g[i].size() == 1) {
    q.push({d[s][i] + f[i][m - 1], {i, m - 1}});
    return ret;
  }
  for (auto& e : g[i])
    if (e != p) ret += dfs(e, i);
  return ret;
}
void solve() {
  int n, u, v, w;
  cin >> n;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j) d[i][j] = inf;
  for (int i = 0; i < (n - 1); ++i) {
    cin >> u >> v >> w;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
    d[u][v] = d[v][u] = w;
  }
  for (int k = 0; k < (n); ++k)
    for (int i = 0; i < (n); ++i)
      for (int j = 0; j < (n); ++j) Min(d[i][j], d[i][k] + d[k][j]);
  cin >> s >> m;
  s--;
  for (int i = 0; i < (m); ++i) {
    cin >> u;
    cnt[--u]++;
  }
  for (int k = 1; k <= (m); ++k) {
    for (int i = 0; i < (n); ++i)
      if (g[i].size() == 1) {
        q = priority_queue<pair<int, pair<int, int>>>();
        for (int j = 0; j < (n); ++j)
          if (g[j].size() == 1 && j != i) {
            q.push({d[i][j] + f[j][k - 1], {j, k - 1}});
          }
        for (int it = 0; it < (k - 1); ++it) {
          auto cur = q.top();
          q.pop();
          int j = cur.second.first, k2 = cur.second.second - 1;
          q.push({d[i][j] + f[j][k2], {j, k2}});
        }
        f[i][k] = q.top().first;
      }
  }
  int ans = 50 * 50 * m;
  for (auto& e : g[s]) {
    q = priority_queue<pair<int, pair<int, int>>>();
    int k = dfs(e, s);
    if (!k) continue;
    for (int it = 0; it < (k - 1); ++it) {
      auto cur = q.top();
      q.pop();
      int j = cur.second.first, k2 = cur.second.second - 1;
      q.push({d[s][j] + f[j][k2], {j, k2}});
    }
    Min(ans, q.top().first);
  }
  cout << ans << '\n';
}
void init() {}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  init();
  int TC = 1;
  for (int TI = 1; TI <= (TC); ++TI) {
    solve();
  }
  return 0;
}