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;
}
struct edge {
  int to, w, id;
};
const int N = 51, inf = 50 * 50 * 50;
vector<edge> g[N];
int eid;
int cnt[N];
map<array<int, 3>, int> memo;
int go(int from, int to, int w, int id, int tot, int front) {
  assert(front <= tot);
  if (tot == 0) return 0;
  auto& ret = memo[{id, tot, front}];
  if (ret) return ret;
  ret += w;
  if (g[to].size() == 1) {
    return ret += go(to, from, w, g[to][0].id, tot - front, tot - front);
  }
  if (g[to].size() == 2) {
    int i = 0;
    if (g[to][0].to == from) i = 1;
    auto& e = g[to][i];
    return ret += go(to, e.to, e.w, e.id, tot, front);
  }
  priority_queue<pair<int, pair<int, int>>> q;
  for (int i = 0; i < (g[to].size()); ++i)
    if (g[to][i].to != from) {
      auto& e = g[to][i];
      q.push({go(to, e.to, e.w, e.id, tot, 1), {i, 1}});
    }
  for (int it = 0; it < (front - 1); ++it) {
    auto cur = q.top();
    q.pop();
    int i = cur.second.first, cnt = cur.second.second;
    auto& e = g[to][i];
    q.push({go(to, e.to, e.w, e.id, tot, cnt + 1), {i, cnt + 1}});
  }
  return ret += q.top().first;
}
int getsz(int i, int p) {
  int ret = cnt[i];
  for (auto& e : g[i])
    if (e.to != p) ret += getsz(e.to, i);
  return ret;
}
void solve() {
  int n, u, v, w;
  cin >> n;
  for (int i = 0; i < (n - 1); ++i) {
    cin >> u >> v >> w;
    g[u].push_back({v, w, eid++});
    g[v].push_back({u, w, eid++});
  }
  int s, m;
  cin >> s >> m;
  for (int i = 0; i < (m); ++i) {
    cin >> u;
    cnt[u]++;
  }
  int ans = 50 * 50 * m;
  for (auto& e : g[s]) {
    int sz = getsz(e.to, s);
    Min(ans, go(s, e.to, e.w, e.id, m, sz));
  }
  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;
}