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 N = 55;
const int INF = 1.01e9;
struct State {
  int v, u, x, y;
  bool operator<(State A) const { return vect() < A.vect(); }
  vector<int> vect() const { return {v, u, x, y}; }
  void Epr() {
    cerr << "v u x y: " << v << " " << u << " " << x << " " << y << endl;
  }
};
map<State, int> q;
vector<pair<int, int>> e[N];
map<pair<int, int>, int> costE;
int go(State st) {
  assert(st.x >= 0 && st.y >= 0);
  if (st.x == 0) {
    assert(st.y > 0);
    return INF;
  }
  auto it = q.find(st);
  if (it == q.end()) {
    int v = st.v;
    int u = st.u;
    int x = st.x;
    int y = st.y;
    int sum = x + y;
    int& answer = q[st];
    if (e[u].size() == 1) {
      if (y == 0) {
        answer = e[u][0].second;
      } else {
        answer = go({u, v, y, 0}) + e[u][0].second;
      }
    } else if (e[u].size() == 2) {
      int other = e[u][0].first + e[u][1].first - v;
      answer = go({u, other, x, y}) + costE[make_pair(v, u)];
    } else {
      vector<pair<int, int>> ch;
      for (auto h : e[u]) {
        if (h.first != v) {
          ch.push_back(h);
        }
      }
      vector<vector<int>> preCalc(ch.size(), vector<int>(st.x + 1));
      set<pair<int, int>> w;
      for (int i = 0; i < (int)(ch.size()); i++) {
        w.insert({go({u, ch[i].first, 1, sum - 1}), i});
      }
      int last = -1;
      vector<int> lastVal(ch.size(), 1);
      for (int _ = 0; _ < (int)(x); _++) {
        auto g = *w.rbegin();
        last = g.first;
        if (_ + 1 == x) break;
        assert(w.erase(g));
        lastVal[g.second]++;
        int superVal = go({u, ch[g.second].first, lastVal[g.second],
                           sum - lastVal[g.second]});
        w.insert({superVal, g.second});
      }
      answer = last + costE[make_pair(v, u)];
    }
    return answer;
  } else {
    return it->second;
  }
}
int cnt[N];
bool use[N];
void dfs(int v) {
  use[v] = 1;
  for (auto x : e[v]) {
    int u = x.first;
    if (!use[u]) {
      dfs(u);
      cnt[v] += cnt[u];
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (int)(n - 1); i++) {
    int v, u, w;
    scanf("%d%d%d", &v, &u, &w);
    v--;
    u--;
    e[v].push_back({u, w});
    e[u].push_back({v, w});
    costE[make_pair(v, u)] = w;
    costE[make_pair(u, v)] = w;
  }
  int s;
  scanf("%d", &s);
  s--;
  int m;
  scanf("%d", &m);
  for (int i = 0; i < (int)(m); i++) {
    int id;
    scanf("%d", &id);
    id--;
    cnt[id]++;
  }
  dfs(s);
  assert(cnt[s] == m);
  int answer = INF;
  for (auto x : e[s]) {
    answer = min(answer, go({s, x.first, cnt[x.first], m - cnt[x.first]}));
  }
  cout << answer << endl;
  return 0;
}