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 T>
inline bool chkmax(T &x, const T &y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T &x, const T &y) {
  return x > y ? x = y, 1 : 0;
}
struct IO {
  static const int maxn = (1 << 25) + 10;
  char a[maxn], *s, b[maxn], *t;
  void INPUT() {
    s = a;
    t = b;
    a[fread(a, 1, sizeof a, stdin)] = 0;
  }
  void OUTPUT() { fwrite(b, 1, t - b, stdout); }
  operator int() {
    int x = 0;
    while (*s != '-' && (*s < '0' || *s > '9')) {
      ++s;
    }
    bool f = 0;
    if (*s == '-') {
      f = 1;
      ++s;
    }
    while (*s >= '0' && *s <= '9') {
      (x *= 10) += *s - '0';
      ++s;
    }
    if (f) {
      x = -x;
    }
    return x;
  }
  operator long long() {
    long long x = 0;
    while (*s != '-' && (*s < '0' || *s > '9')) {
      ++s;
    }
    bool f = 0;
    if (*s == '-') {
      f = 1;
      ++s;
    }
    while (*s >= '0' && *s <= '9') {
      (x *= 10) += *s - '0';
      ++s;
    }
    if (f) {
      x = -x;
    }
    return x;
  }
  operator char() {
    while (*s <= 32) {
      ++s;
    }
    char ret = *s;
    ++s;
    return ret;
  }
  inline void out(int x) {
    if (!x) {
      *t++ = '0';
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      int y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    return;
  }
  inline void out(int x, char C) {
    if (!x) {
      *t++ = '0';
      *t++ = C;
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      int y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    *t++ = C;
    return;
  }
  inline void out(long long x) {
    if (!x) {
      *t++ = '0';
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      long long y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    return;
  }
  inline void out(long long x, char C) {
    if (!x) {
      *t++ = '0';
      *t++ = C;
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      long long y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    *t++ = C;
    return;
  }
  inline void out(char c) {
    *t++ = c;
    return;
  }
  inline void out(char *s) {
    while (*s >= ' ') {
      *t++ = *s++;
    }
    return;
  }
} io;
void Main();
int main(int argc, char *argv[]) {
  io.INPUT();
  Main();
  io.OUTPUT();
  return 0;
}
const int maxn = 55, oo = 1123456789;
int dp[maxn << 1][maxn][maxn];
vector<int> g[maxn];
bool isleaf[maxn];
int n, m, S;
int u[maxn], v[maxn], cnt[maxn], w[maxn];
void dfs(int S, int p = 0) {
  for (int i : g[S]) {
    int T = (i & 1) ? u[i >> 1] : v[i >> 1];
    if (T != p) {
      dfs(T, S);
      cnt[S] += cnt[T];
    }
  }
  return;
}
int DP(int i, int lft, int tot) {
  int &ret = dp[i][lft][tot];
  if (~ret) {
    return ret;
  }
  int to = (i & 1) ? u[i >> 1] : v[i >> 1];
  ;
  if (isleaf[to]) {
    ;
    return ret = (tot == lft ? w[i >> 1]
                             : DP(i ^ 1, tot - lft, tot - lft) + w[i >> 1]);
  }
  int tmp[maxn];
  memset(tmp, -1, sizeof tmp);
  tmp[0] = oo;
  for (int j : g[to]) {
    if ((j ^ 1) != i) {
      for (int x = (lft), x_end_ = (1); x >= x_end_; --x) {
        for (int y = (1), y_end_ = (x); y <= y_end_; ++y) {
          chkmax(tmp[x], min(tmp[x - y], DP(j, y, tot)));
        }
      }
    }
  };
  return ret = tmp[lft] + w[i >> 1];
}
void Main() {
  memset(dp, -1, sizeof dp);
  n = io;
  for (int i = 0, i_end_ = (n - 1); i < i_end_; ++i) {
    u[i] = io;
    v[i] = io;
    w[i] = io;
    g[u[i]].push_back(i << 1);
    g[v[i]].push_back((i << 1) | 1);
  }
  S = io;
  m = io;
  int tot = 0;
  for (int i = 0, i_end_ = (m); i < i_end_; ++i) {
    int x = io;
    ++cnt[x];
    tot += (x != S);
  }
  for (int u = (1), u_end_ = (n); u <= u_end_; ++u) {
    if ((int)((g[u]).size()) == 1) {
      isleaf[u] = 1;
    }
  }
  dfs(S);
  int ans = oo;
  for (int i : g[S]) {
    int T = (i & 1) ? u[i >> 1] : v[i >> 1];
    chkmin(ans, DP(i, cnt[T], tot));
    ;
  }
  io.out(ans, '\n');
  return;
}