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>
const long long INF = 4e18L + 1;
const int IINF = 2e9 + 1;
using namespace std;
template <class TH>
void _dbg(const char* sdbg, TH h) {
  cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char* sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
const int N = 50, M = 50;
vector<pair<int, int> > nei[N + 1];
int n, m, s;
bool visited[N + 1];
long long dp[M + 1][N + 1];
int st_v, full_c;
int dfs(int v, int T) {
  visited[v] = true;
  if (v != st_v and (int)((nei[v]).size()) == 1) {
    for (long long i = (long long)1; i < (long long)full_c + 1; i++) {
      if (dp[full_c - i][v] <= T) {
        return i;
      }
    }
    return M + 1;
  } else {
    int sm = 0;
    for (auto& wp : nei[v]) {
      if (!visited[wp.first]) {
        int rec = dfs(wp.first, T - wp.second);
        if (!rec) {
          return 0;
        } else {
          sm += rec - 1;
        }
      }
    }
    return sm + 1;
  }
}
bool chk(int c, int c1, int u, int v, int T) {
  memset(visited, 0, (n + 1));
  visited[u] = true;
  if (u == 0) {
    st_v = v;
  } else {
    st_v = 0;
  }
  full_c = c;
  return dfs(v, T) <= c1;
}
int get_val(int c, int c1, int u, int v) {
  int start = -1, fin = N * N * N + 1;
  while (fin - start > 1) {
    int mid = (start + fin) / 2;
    if (chk(c, c1, u, v, mid)) {
      fin = mid;
    } else {
      start = mid;
    }
  }
  return fin;
}
int ter_cnt[N + 1];
void dfs_cnt(int v) {
  visited[v] = true;
  for (auto& wp : nei[v]) {
    if (!visited[wp.first]) {
      dfs_cnt(wp.first);
      ter_cnt[v] += ter_cnt[wp.first];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long _ = (long long)0; _ < (long long)n - 1; _++) {
    int u, v, w;
    cin >> u >> v >> w;
    nei[u].push_back({v, w});
    nei[v].push_back({u, w});
  }
  cin >> s;
  cin >> m;
  for (long long _ = (long long)0; _ < (long long)m; _++) {
    int t1;
    cin >> t1;
    ter_cnt[t1]++;
  }
  dfs_cnt(s);
  for (long long c = (long long)1; c < (long long)m + 1; c++) {
    for (long long v = (long long)1; v < (long long)n + 1; v++) {
      if ((int)((nei[v]).size()) == 1) {
        dp[c][v] = get_val(c, c, 0, v);
        (c, v, dp[c][v]);
      }
    }
  }
  int res = IINF;
  for (auto& wp : nei[s]) {
    res = min(res, wp.second + get_val(m, ter_cnt[wp.first], s, wp.first));
  }
  cout << res << "\n";
  return 0;
}