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>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 924844033;
const ll root = 62;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 51;
int dp[2 * mxN][mxN][mxN];
int n, s, m;
vector<pair<int, int> > adj[mxN];
array<int, 3> edges[2 * mxN];
int back[mxN][mxN];
int crim[mxN];
int solve(int i, int in, int ot) {
  if (dp[i][in][ot] != -1) return dp[i][in][ot];
  int from = edges[i][0];
  int to = edges[i][1];
  if (adj[to].size() == 1) {
    return (ot ? edges[i][2] + solve(back[to][from], ot, 0) : edges[i][2]);
  }
  int res = 0;
  int num = 0;
  int dpmx[in + 1];
  int save[in + 1];
  memset(dpmx, -INF, sizeof(dpmx));
  dpmx[0] = INF;
  for (auto v : adj[to]) {
    if (v.first ^ from) {
      for (int i = (0); i < (in + 1); ++i) {
        save[i] = dpmx[i];
      }
      for (int i = (1); i < (in + 1); ++i) {
        for (int j = (0); j < (in - i + 1); ++j) {
          save[i + j] =
              max(save[i + j],
                  min(dpmx[j], solve(back[to][v.first], i, ot + in - i)));
        }
      }
      for (int i = (0); i < (in + 1); ++i) {
        dpmx[i] = save[i];
      }
    }
  }
  return dp[i][in][ot] = dpmx[in] + edges[i][2];
}
int dfs(int u, int p) {
  int res = crim[u];
  for (auto v : adj[u]) {
    if (v.first ^ p) {
      res += dfs(v.first, u);
    }
  }
  return res;
}
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  int a, b, c;
  memset(dp, -1, sizeof(dp));
  for (int i = (0); i < (n - 1); ++i) {
    cin >> a >> b >> c;
    a--;
    b--;
    adj[a].push_back({b, c});
    adj[b].push_back({a, c});
    edges[2 * i] = {a, b, c};
    back[a][b] = 2 * i;
    edges[2 * i + 1] = {b, a, c};
    back[b][a] = 2 * i + 1;
  }
  cin >> s;
  s--;
  cin >> m;
  for (int i = (0); i < (m); ++i) {
    cin >> a;
    crim[a - 1]++;
  }
  int ans = INF;
  for (auto v : adj[s]) {
    int in = dfs(v.first, s);
    ans = min(ans, solve(back[s][v.first], in, m - in));
  }
  cout << ans << "\n";
  return 0;
}