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 comment(linker, "/STACK:512000000")
using namespace std;
void solve(bool);
void precalc();
clock_t start;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  int testNum = 1;
  while (t--) {
    solve(true);
  }
  cout.flush();
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
template <typename T>
void make_unique(vector<T>& a) {
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
}
template <typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}
template <typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}
void precalc() {}
const int INF = (int)1e9;
vector<vector<int>> comps;
vector<vector<int>> g;
void dfs(int v, int p) {
  comps.back().push_back(v);
  for (int to : g[v]) {
    if (to == p) {
      continue;
    }
    dfs(to, v);
  }
}
void solve(bool read) {
  int n;
  if (read) {
    cin >> n;
  } else {
    n = 50;
  }
  g.clear();
  comps.clear();
  g.resize(n);
  vector<vector<int>> matrix(n, vector<int>(n, INF));
  for (int i = 0; i < n; ++i) {
    matrix[i][i] = 0;
  }
  for (int i = 1; i < n; ++i) {
    int a, b, cost;
    if (read) {
      cin >> a >> b >> cost;
      --a;
      --b;
    } else {
      a = i;
      b = i - 1;
      cost = rand() % 50 + 1;
    }
    g[a].push_back(b);
    g[b].push_back(a);
    matrix[a][b] = matrix[b][a] = cost;
  }
  int root;
  if (read) {
    cin >> root;
    --root;
  } else {
    root = rand() % n;
  }
  int m;
  if (read) {
    cin >> m;
  } else {
    m = 50;
  }
  vector<int> x(m);
  for (int i = 0; i < m; ++i) {
    if (read) {
      cin >> x[i];
      --x[i];
    } else {
      do {
        x[i] = rand() % n;
      } while (x[i] == root);
    }
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        matrix[i][j] = min(matrix[i][j], matrix[i][k] + matrix[k][j]);
      }
    }
  }
  vector<vector<int>> dp(m + 1, vector<int>(n, 0));
  for (int have = 1; have <= m; ++have) {
    for (int i = 0; i < n; ++i) {
      if (g[i].size() > 1) {
        continue;
      }
      for (int j = 0; j < n; ++j) {
        if (g[j].size() == 1) {
          dp[have][i] = max(dp[have][i], matrix[i][j]);
        }
      }
      int L = dp[have][i], R = (int)INF;
      while (L + 1 < R) {
        int M = (L + R) / 2;
        int can = 0;
        for (int j = 0; j < n; ++j) {
          if (g[j].size() == 1 && i != j) {
            for (int use = 0; use < have; ++use) {
              if (dp[use][j] + matrix[i][j] >= M) {
                can += have - use;
                break;
              }
            }
          }
        }
        if (can >= have) {
          L = M;
        } else {
          R = M;
        }
      }
      dp[have][i] = L;
    }
  }
  for (int to : g[root]) {
    comps.push_back(vector<int>());
    dfs(to, root);
  }
  vector<int> bad(comps.size());
  for (int g : x) {
    for (int i = 0; i < comps.size(); ++i) {
      for (int num : comps[i]) {
        if (num == g) {
          ++bad[i];
          break;
        }
      }
    }
  }
  int L = 0, R = INF;
  while (L + 1 < R) {
    int M = (L + R) / 2;
    bool good = true;
    for (int i = 0; i < comps.size(); ++i) {
      int can = 0;
      for (int j : comps[i]) {
        if (g[j].size() == 1) {
          for (int rest = m - bad[i]; rest < m; ++rest) {
            if (dp[rest][j] + matrix[root][j] >= M) {
              can += m - rest;
              break;
            }
          }
        }
      }
      if (can < bad[i]) {
        good = false;
        break;
      }
    }
    if (good) {
      L = M;
    } else {
      R = M;
    }
  }
  cout << L << endl;
}