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 T>
bool chmin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <typename T>
bool chmax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}
const int maxN = 50 + 5;
const int INF = 0x3f3f3f3f;
int n, m, s, cnt[maxN];
vector<pair<int, int> > G[maxN];
int f[maxN][maxN], d[maxN][maxN];
bitset<maxN> g, h;
void dfs(int u, int fa, int d[]) {
  for (auto p : G[u]) {
    int v = p.first, w = p.second;
    if (v == fa) continue;
    d[v] = d[u] + w;
    dfs(v, u, d);
  }
}
vector<int> lf;
int cntr;
void seek(int u, int fa) {
  if (G[u].size() == 1) lf.push_back(u);
  cntr += cnt[u];
  for (auto p : G[u])
    if (p.first != fa) seek(p.first, u);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int x, y, z;
    cin >> x >> y >> z;
    G[x].emplace_back(y, z);
    G[y].emplace_back(x, z);
  }
  cin >> s >> m;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    cnt[x]++;
    assert(x != s);
  }
  for (int u = 1; u <= n; ++u) {
    d[u][u] = 0;
    dfs(u, -1, d[u]);
  }
  memset(f, INF, sizeof(f));
  for (int u = 1; u <= n; ++u)
    if (G[u].size() == 1) f[0][u] = 0;
  for (int c = 1; c <= m; ++c)
    for (int u = 1; u <= n; ++u)
      if (G[u].size() == 1) {
        auto check = [&](int T) {
          g.reset();
          g[0] = true;
          for (int v = 1; v <= n; ++v)
            if (G[v].size() == 1) {
              h.reset();
              for (int tc = 0; tc <= c; ++tc)
                if (f[c - tc][v] + d[u][v] >= T) {
                  h |= g << tc;
                }
              swap(g, h);
            }
          return g[c];
        };
        int L = 0, R = n * 50 * 50;
        while (L < R) {
          int M = (L + R + 1) >> 1;
          if (check(M))
            L = M;
          else
            R = M - 1;
        }
        f[c][u] = L;
      }
  int ans = n * 50 * 50;
  for (auto p : G[s]) {
    lf.clear();
    cntr = 0;
    seek(p.first, s);
    auto check = [&](int T) {
      g.reset();
      g[0] = true;
      for (int v : lf) {
        h.reset();
        for (int tc = 0; tc <= cntr; ++tc)
          if (f[m - tc][v] + d[s][v] >= T) {
            h |= g << tc;
          }
        swap(g, h);
      }
      return g[cntr];
    };
    int L = 0, R = n * 50 * 50;
    while (L < R) {
      int M = (L + R + 1) >> 1;
      if (check(M))
        L = M;
      else
        R = M - 1;
    }
    chmin(ans, L);
  }
  cout << ans << endl;
  return 0;
}