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 MOD = (int)1e9 + 7;
const int MOD2 = 1007681537;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-12;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return val < a ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline int sign(long double x) { return x < -EPS ? -1 : x > +EPS; }
inline int sign(long double x, long double y) { return sign(x - y); }
const int maxn = 50 + 5;
int n, s;
int a[maxn];
vector<pair<int, int> > adj[maxn];
int size[maxn];
int d[maxn][maxn];
int dp[maxn][maxn][maxn][maxn];
void dfs(int u, int p) {
  size[u] = a[u];
  for (int i = (0); i < (int((adj[u]).size())); i++) {
    int v = adj[u][i].first;
    if (v != p) {
      dfs(v, u);
      size[u] += size[v];
    }
  }
}
int calc(int u, int p, int t1, int t2) {
  int& res = dp[u][p][t1][t2];
  if (~res) return res;
  res = INF;
  vector<pair<pair<int, int>, int> > vals;
  vector<int> fmn(n, 0), fmx(n, 0);
  for (int v = (0); v < (n); v++)
    if (v != u && v != p && int((adj[v]).size()) == 1 &&
        (p == n || d[p][u] + d[u][v] == d[p][v])) {
      for (int tt = (1); tt < (t1 + 1); tt++) {
        vals.push_back(make_pair(
            make_pair(calc(v, u, tt, t2 + t1 - tt) + d[u][v], tt), v));
      }
    }
  if (!int((vals).size())) {
    if (!t2) return res = 0;
    return res = calc(u, n, t2, 0);
  }
  sort((vals).begin(), (vals).end()), reverse((vals).begin(), (vals).end());
  int totmn = 0, totmx = 0;
  for (int i = (0); i < (int((vals).size())); i++) {
    int v = vals[i].second;
    int tt = vals[i].first.second;
    totmn -= fmn[v];
    totmx -= fmx[v];
    if (!fmn[v])
      fmn[v] = tt;
    else
      chkmin(fmn[v], tt);
    if (!fmx[v])
      fmx[v] = tt;
    else
      chkmax(fmx[v], tt);
    if (fmn[v] == 1) fmn[v] = 0;
    totmn += fmn[v];
    totmx += fmx[v];
    if (totmn <= t1 && t1 <= totmx) {
      return res = vals[i].first.first;
    }
  }
  return res;
}
void solve() {
  cin >> n;
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (n); j++) d[i][j] = i == j ? 0 : INF;
  for (int i = (0); i < (n - 1); i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    chkmin(d[u][v], w);
    chkmin(d[v][u], w);
    adj[u].push_back(make_pair(v, w));
    adj[v].push_back(make_pair(u, w));
  }
  for (int k = (0); k < (n); k++)
    for (int i = (0); i < (n); i++)
      for (int j = (0); j < (n); j++) chkmin(d[i][j], d[i][k] + d[k][j]);
  cin >> s;
  s--;
  int m;
  cin >> m;
  for (int i = (0); i < (m); i++) {
    int x;
    cin >> x;
    x--;
    a[x]++;
  }
  dfs(s, -1);
  memset(dp, -1, sizeof(dp));
  int res = INF;
  for (int i = (0); i < (int((adj[s]).size())); i++) {
    int u = adj[s][i].first;
    int w = adj[s][i].second;
    if (size[u]) {
      chkmin(res, calc(u, s, size[u], m - size[u]) + w);
    }
  }
  cout << res << "\n";
}
int main() {
  int JUDGE_ONLINE = 1;
  if (fopen("in.txt", "r")) {
    JUDGE_ONLINE = 0;
    assert(freopen("in.txt", "r", stdin));
  } else {
    ios_base::sync_with_stdio(0), cin.tie(0);
  }
  solve();
  if (!JUDGE_ONLINE) {
  }
  return 0;
}