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 A>
ostream &operator<<(ostream &cout, vector<A> const &v);
template <typename A, typename B>
ostream &operator<<(ostream &cout, pair<A, B> const &p) {
  return cout << "(" << p.first << ", " << p.second << ")";
}
template <typename A>
ostream &operator<<(ostream &cout, vector<A> const &v) {
  cout << "[";
  for (int i = 0; i < v.size(); i++) {
    if (i) cout << ", ";
    cout << v[i];
  }
  return cout << "]";
}
template <typename A, typename B>
istream &operator>>(istream &cin, pair<A, B> &p) {
  cin >> p.first;
  return cin >> p.second;
}
mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
void usaco(string filename) {
  freopen((filename + ".in").c_str(), "r", stdin);
  freopen((filename + ".out").c_str(), "w", stdout);
}
const long double pi = 3.14159265358979323846;
const long long mod = 1000000007;
long long n, m, k, q, l, r, x, y, z;
const long long template_array_size = 1e6 + 8432;
long long a[template_array_size];
long long b[template_array_size];
long long c[template_array_size];
string second, t;
long long ans = 0;
vector<pair<long long, long long>> edges[55];
vector<long long> cur;
long long cnt[55];
long long dp[55][55];
long long cost[55];
long long par[55];
long long at[55];
long long dist[55];
long long count(long long v, long long p) {
  for (pair<long long, long long> x : edges[v])
    if (x.first != p) cnt[v] += count(x.first, v);
  return cnt[v];
}
void dfs(long long v, long long p, long long d) {
  dist[v] = d;
  par[v] = p;
  bool leaf = 1;
  for (pair<long long, long long> x : edges[v])
    if (x.first != p) {
      dfs(x.first, v, d + x.second);
      leaf = 0;
    }
  if (leaf) cur.push_back(v);
}
long long rec(long long pos, long long cnt);
long long getv(long long v, long long p, long long cnt, long long diff) {
  memset(at, 0, sizeof(at));
  cur.clear();
  dfs(v, p, 0);
  long long ans = 1e18;
  for (long long it = 0; it < cnt; it++) {
    long long wpos = -1, wval = -1;
    for (long long x : cur) {
      cost[x] = dist[x] + rec(x, cnt + diff - (at[x] + 1));
      if (cost[x] > wval) {
        wval = cost[x];
        wpos = x;
      }
    }
    ++at[wpos];
    ans = min(ans, wval);
  }
  return ans;
}
long long rec(long long pos, long long cnt) {
  if (cnt == 0) return 0;
  if (dp[pos][cnt] != -1) return dp[pos][cnt];
  assert(edges[pos].size() == 1);
  long long v = edges[pos][0].second + getv(edges[pos][0].first, pos, cnt, 0);
  return dp[pos][cnt] = v;
}
void solve(int tc = 0) {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    cin >> x >> y >> z;
    --x;
    --y;
    edges[x].push_back({y, z});
    edges[y].push_back({x, z});
  }
  long long second;
  cin >> second;
  --second;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> x;
    --x;
    ++cnt[x];
  }
  count(second, -1);
  for (long long i = 0; i <= m; i++) {
    for (long long j = 0; j < n; j++) {
      if (edges[j].size() == 1) {
        rec(j, i);
      }
    }
  }
  long long ans = 1e18;
  for (pair<long long, long long> x : edges[second])
    ans = min(ans,
              x.second + getv(x.first, second, cnt[x.first], m - cnt[x.first]));
  cout << ans << '\n';
}
int main() {
  { ios_base::sync_with_stdio(false); }
  { cin.tie(NULL); }
  cout << setprecision(12) << fixed;
  int tc = 1;
  for (int t = 0; t < tc; t++) solve(t);
}