#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int n, s, m, k, tot, dis[N][N], fi[N], a[N << 1], ne[N << 1], c[N << 1], cn[N],
    f[N][N];
vector<int> lv;
inline void add(int x, int y, int z) {
  a[++tot] = y;
  c[tot] = z;
  ne[tot] = fi[x];
  fi[x] = tot;
}
inline void gl(int x, int fa) {
  if (!ne[fi[x]]) lv.push_back(x);
  for (int i = fi[x]; i; i = ne[i])
    if (a[i] != fa) gl(a[i], x);
}
inline void gd(int x, int fa, int *de) {
  for (int i = fi[x]; i; i = ne[i])
    if (a[i] != fa) de[a[i]] = de[x] + c[i], gd(a[i], x, de);
}
inline int gn(int x, int fa) {
  int ans = cn[x];
  for (int i = fi[x]; i; i = ne[i])
    if (a[i] != fa) ans += gn(a[i], x);
  return ans;
}
inline bool check(int p, int x, int mid, int ap) {
  for (int i = 0; i < (int)lv.size(); ++i)
    if (i != x) {
      int t = 1;
      while (t <= ap && f[ap - t][lv[i]] + dis[lv[x]][lv[i]] >= mid) ++t;
      p -= t - 1;
      if (p <= 0) return 1;
    }
  return 0;
}
inline bool check2(int mid) {
  for (int i = fi[s]; i; i = ne[i]) {
    lv.clear();
    gl(a[i], s);
    lv.push_back(s);
    int t = gn(a[i], s);
    if (!check(t, lv.size() - 1, mid, m)) return 0;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  int x, y, z;
  for (int i = 1; i < n; ++i)
    scanf("%d%d%d", &x, &y, &z), add(x, y, z), add(y, x, z);
  scanf("%d%d", &s, &m);
  for (int i = 1; i <= m; ++i) scanf("%d", &x), ++cn[x];
  memset(f, 0x3f, sizeof f);
  for (int i = 1; i <= n; ++i) gd(i, 0, dis[i]);
  gl(1, 0);
  k = lv.size();
  for (int i = 0; i < k; ++i) f[0][lv[i]] = 0;
  for (int p = 1; p <= m; ++p)
    for (int i = 0; i < k; ++i) {
      for (int l = 0, r = 1e5, mid; l <= r; mid = (l + r) >> 1,
               check(p, i, mid, p) ? f[p][lv[i]] = mid,
               l = mid + 1         : r = mid - 1)
        ;
    }
  int ans = 1e9;
  for (int l = 0, r = 1e5, mid; l <= r;
       mid = (l + r) >> 1, check2(mid) ? ans = mid, l = mid + 1 : r = mid - 1)
    ;
  printf("%d", ans);
  return 0;
}
