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>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 60;
const int max_ans = 1e7;
int n;
int dp[maxn + 5][maxn + 5];
vector<pair<int, int> > adj[maxn + 5];
int f[maxn + 5][maxn + 5];
bool leaf[maxn + 5];
int s, m;
int cri[maxn + 5];
inline bool check0(int ccnt, int rt, int lim) {
  int ret = 0;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    if (i != rt && leaf[i]) {
      if (f[rt][i] > lim) return 0;
      int k = 0;
      while (k < ccnt && dp[ccnt - k - 1][i] + f[rt][i] > lim) ++k;
      ret += k;
    }
  return ret < ccnt;
}
inline bool check1(int ccnt, vector<int> leaves, int lim) {
  int ret = 0;
  for (auto i : leaves) {
    if (f[s][i] > lim) return 0;
    int k = 0;
    while (k < m && dp[m - k - 1][i] + f[s][i] > lim) ++k;
    ret += k;
  }
  return ret < ccnt;
}
int tot_cri[maxn + 5];
vector<int> leaves[maxn + 5];
int fa[maxn + 5];
void dfs(int first) {
  for (auto second : adj[first])
    if (second.first != fa[first]) fa[second.first] = first, dfs(second.first);
}
int main() {
  scanf("%d", &n);
  memset(f, oo, sizeof f);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) f[i][i] = 0;
  for (int i = (0), i_end_ = (n - 1); i < i_end_; ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w), --u, --v;
    f[u][v] = f[v][u] = w;
    adj[u].push_back(make_pair(v, w));
    adj[v].push_back(make_pair(u, w));
  }
  scanf("%d%d", &s, &m);
  --s;
  for (int i = (0), i_end_ = (m); i < i_end_; ++i) {
    int first;
    scanf("%d", &first), --first;
    if (first == s)
      --m;
    else
      ++cri[first];
  }
  for (int k = (0), k_end_ = (n); k < k_end_; ++k)
    for (int i = (0), i_end_ = (n); i < i_end_; ++i)
      for (int j = (0), j_end_ = (n); j < j_end_; ++j)
        chkmin(f[i][j], f[i][k] + f[k][j]);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    leaf[i] = (int((adj[i]).size())) == 1;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    if (leaf[i]) dp[0][i] = 0;
  for (int i = (1), i_end_ = (m + 1); i < i_end_; ++i) {
    for (int j = (0), j_end_ = (n); j < j_end_; ++j)
      if (leaf[j]) {
        int l = 0, r = max_ans;
        while (l < r) {
          int mid = (l + r) >> 1;
          if (check0(i, j, mid))
            r = mid;
          else
            l = mid + 1;
        }
        dp[i][j] = l;
      }
  }
  fa[s] = -1;
  dfs(s);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    if (i != s) {
      int u = i;
      while (fa[u] != s) u = fa[u];
      tot_cri[u] += cri[i];
      if (leaf[i]) leaves[u].push_back(i);
    }
  int ans = max_ans;
  for (auto u : adj[s]) {
    int first = u.first;
    int l = 0, r = max_ans;
    while (l < r) {
      int mid = (l + r) >> 1;
      if (check1(tot_cri[first], leaves[first], mid))
        r = mid;
      else
        l = mid + 1;
    }
    chkmin(ans, l);
  }
  printf("%d\n", ans);
  return 0;
}