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;
const int maxN = 57;
const int INF = 1e9 + 7;
template <class T>
inline T rd() {
  bool f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 0;
  T x = 0;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return f ? x : -x;
}
struct vec {
  static const int maxE = maxN;
  int g[maxN], te;
  struct edge {
    int y, d, nxt;
  } e[maxE << 1];
  vec() { te = 1; }
  inline void push(int x, int y, int d) {
    e[++te] = (edge){y, d, g[x]};
    g[x] = te;
  }
  inline void link(int x, int y, int d) { push(x, y, d), push(y, x, d); }
  inline int& operator()(int x) { return g[x]; }
  inline edge& operator[](int x) { return e[x]; }
} e;
int n, m, s;
int sz[maxN];
int f[maxN << 1][maxN];
int num[maxN], g[maxN], id, rt[maxN];
int deg[maxN];
int dis[maxN][maxN], bg;
void getsz(int x, int fa) {
  num[x] = id;
  for (int p = e(x), y = e[p].y; p; y = e[p = e[p].nxt].y)
    if (y != fa) {
      getsz(y, x);
      sz[x] += sz[y];
    }
}
void getdis(int x, int fa) {
  for (int p = e(x), y = e[p].y; p; y = e[p = e[p].nxt].y)
    if (y != fa) {
      dis[bg][y] = dis[bg][x] + e[p].d;
      getdis(y, x);
    }
}
int F(int x, int rest) {
  int& res = f[x][rest];
  if (~res) return res;
  if (rest == 0) return res = 0;
  int l = 0, r = INF, mid, sum;
  while (l != r) {
    mid = (l + r) / 2 + 1, sum = 0;
    for (int i = (1), _ = (n); i <= _; ++i)
      if (x != i && deg[i] == 1) {
        int j;
        for (j = 1; j <= rest; ++j)
          if (dis[x][i] + F(i, rest - j) < mid) break;
        sum += j - 1;
      }
    if (sum >= rest)
      l = mid;
    else
      r = mid - 1;
  }
  return res = l;
}
int main() {
  n = rd<int>();
  for (int i = (1), _ = (n); i < _; ++i) {
    int x = rd<int>(), y = rd<int>(), z = rd<int>();
    e.link(x, y, z);
    deg[x]++, deg[y]++;
  }
  for (int i = (1), _ = (n); i <= _; ++i) {
    dis[i][i] = 0;
    getdis(bg = i, 0);
  }
  s = rd<int>();
  m = rd<int>();
  for (int i = (1), _ = (m); i <= _; ++i) sz[rd<int>()]++;
  for (int p = e(s), y = e[p].y; p; y = e[p = e[p].nxt].y) {
    rt[++id] = y;
    getsz(y, s);
  }
  memset(f, -1, sizeof f);
  F(1, 2);
  int l = 0, r = INF, mid;
  while (l != r) {
    mid = (l + r) / 2 + 1;
    memset(g, 0, sizeof g);
    for (int i = (1), _ = (n); i <= _; ++i)
      if (i != s && deg[i] == 1) {
        int j;
        for (j = 1; j <= sz[rt[num[i]]]; ++j)
          if (dis[s][i] + F(i, m - j) < mid) break;
        g[num[i]] += j - 1;
      }
    bool ok = 1;
    for (int i = (1), _ = (id); i <= _; ++i)
      if (g[i] < sz[rt[i]]) ok = 0;
    if (ok)
      l = mid;
    else
      r = mid - 1;
  }
  printf("%d\n", l);
  return 0;
}