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.

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.

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.

NoteIn 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.

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.io.IOException;
import java.util.ArrayList;
import java.io.UncheckedIOException;
import java.util.List;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            EPolicemanAndATree solver = new EPolicemanAndATree();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class EPolicemanAndATree {
        Debug debug = new Debug(true);
        int[][] fdp;
        int inf = (int) 1e9;
        int[][] f;
        Node[] nodes;

        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.readInt();
            nodes = new Node[n];
            for (int i = 0; i < n; i++) {
                nodes[i] = new Node();
                nodes[i].id = i;
            }

            for (int i = 0; i < n - 1; i++) {
                Node a = nodes[in.readInt() - 1];
                Node b = nodes[in.readInt() - 1];
                Edge e = new Edge();
                e.a = a;
                e.b = b;
                e.w = in.readInt();
                a.next.add(e);
                b.next.add(e);
            }

            Node root = nodes[in.readInt() - 1];

            int m = in.readInt();
            for (int i = 0; i < m; i++) {
                Node node = nodes[in.readInt() - 1];
                node.thief++;
            }
            m -= root.thief;
            root.thief = 0;
            if (m == 0) {
                out.println(0);
                return;
            }

            f = new int[n][m + 1];
            List<Node> leaf = new ArrayList<>(n);
            fdp = new int[n + 1][m + 1];

            for (int i = 1; i <= m; i++) {
                for (int j = 0; j < n; j++) {
                    if (!isLeaf(nodes[j])) {
                        continue;
                    }
                    leaf.clear();
                    dfs(nodes[j], null, 0, leaf);
                    f[j][i] = maxStep(leaf, i, i);
                }
            }

            debug.debug("f", f);
            int ans = inf;
            for (Edge e : root.next) {
                Node node = e.other(root);
                leaf.clear();
                int thief = dfs(node, root, e.w, leaf);
                if (thief == 0) {
                    continue;
                }
                int against = maxStep(leaf, thief, m);
                ans = Math.min(ans, against);
            }

            out.println(ans);
        }

        public int maxStep(List<Node> leaf, int m, int total) {
            SequenceUtils.deepFill(fdp, -inf);
            fdp[0][0] = 0;
            int n = leaf.size();
            for (int i = 1; i <= n; i++) {
                Node node = leaf.get(i - 1);
                for (int j = 0; j <= m; j++) {
                    fdp[i][j] = fdp[i - 1][j];
                    for (int k = 1; k <= j; k++) {
                        if (j - k > 0) {
                            fdp[i][j] = Math.max(fdp[i][j], Math.min(fdp[i - 1][j - k], node.depth + f[node.id][total - k]));
                        } else {
                            fdp[i][j] = Math.max(fdp[i][j], node.depth + f[node.id][total - k]);
                        }
                    }
                }
            }
            return fdp[n][m];
        }

        public boolean isLeaf(Node node) {
            return node.next.size() == 1;
        }

        public int dfs(Node root, Node p, int depth, List<Node> leaf) {
            root.depth = depth;
            boolean isLeaf = true;
            int ans = root.thief;
            for (Edge e : root.next) {
                Node node = e.other(root);
                if (node == p) {
                    continue;
                }
                isLeaf = false;
                ans += dfs(node, root, depth + e.w, leaf);
            }

            if (isLeaf) {
                leaf.add(root);
            }
            return ans;
        }

    }

    static class Debug {
        private boolean offline;
        private PrintStream out = System.err;
        static int[] empty = new int[0];

        public Debug(boolean enable) {
            offline = enable && System.getSecurityManager() == null;
        }

        public Debug debug(String name, Object x) {
            return debug(name, x, empty);
        }

        public Debug debug(String name, Object x, int... indexes) {
            if (offline) {
                if (x == null || !x.getClass().isArray()) {
                    out.append(name);
                    for (int i : indexes) {
                        out.printf("[%d]", i);
                    }
                    out.append("=").append("" + x);
                    out.println();
                } else {
                    indexes = Arrays.copyOf(indexes, indexes.length + 1);
                    if (x instanceof byte[]) {
                        byte[] arr = (byte[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof short[]) {
                        short[] arr = (short[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof boolean[]) {
                        boolean[] arr = (boolean[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof char[]) {
                        char[] arr = (char[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof int[]) {
                        int[] arr = (int[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof float[]) {
                        float[] arr = (float[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof double[]) {
                        double[] arr = (double[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof long[]) {
                        long[] arr = (long[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else {
                        Object[] arr = (Object[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    }
                }
            }
            return this;
        }

    }

    static class SequenceUtils {
        public static void deepFill(Object array, int val) {
            if (!array.getClass().isArray()) {
                throw new IllegalArgumentException();
            }
            if (array instanceof int[]) {
                int[] intArray = (int[]) array;
                Arrays.fill(intArray, val);
            } else {
                Object[] objArray = (Object[]) array;
                for (Object obj : objArray) {
                    deepFill(obj, val);
                }
            }
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private StringBuilder cache = new StringBuilder(10 << 20);
        private final Writer os;

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(int c) {
            return append(c).println();
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class Edge {
        Node a;
        Node b;
        int w;

        Node other(Node x) {
            return a == x ? b : a;
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static class Node {
        List<Edge> next = new ArrayList<>();
        int id;
        int thief;
        int depth;

        public String toString() {
            return "" + id;
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public int n;
        public int s;
        public int m;
        public List<Integer>[] graph;
        public int[][] dist;
        public boolean[] leaf;
        public int[] cc;
        public int MAXANS = 50 * 50 * 50;
        public ArrayList<Integer> leaves;
        public int count;
        public int[][] dp;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            n = in.nextInt();
            dist = new int[n][n];
            for (int[] x : dist) Arrays.fill(x, 1 << 29);
            for (int i = 0; i < n; i++) dist[i][i] = 0;
            graph = LUtils.genArrayList(n);
            for (int i = 0; i < n - 1; i++) {
                int a = in.nextInt() - 1, b = in.nextInt() - 1, c = in.nextInt();
                dist[a][b] = dist[b][a] = c;
                graph[a].add(b);
                graph[b].add(a);
            }
            leaf = new boolean[n];
            for (int i = 0; i < n; i++) {
                leaf[i] = graph[i].size() == 1;
            }
            for (int k = 0; k < n; k++) {
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < n; j++) {
                        dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
                    }
                }
            }
            s = in.nextInt() - 1;
            m = in.nextInt();
            cc = new int[n];
            for (int i = 0; i < m; i++) cc[in.nextInt() - 1]++;

            dp = new int[n + 1][m + 1];
            int best = Integer.MAX_VALUE;
            for (int[] x : dp) Arrays.fill(x, -1);
            for (int j : graph[s]) {
                count = 0;
                leaves = new ArrayList<>();
                dfs(j, s);

                if (count > 0) {
                    int lo = 0, hi = MAXANS;
                    while (lo < hi) {
                        int mid = (lo + hi + 1) / 2;
                        if (can2(mid, count)) lo = mid;
                        else hi = mid - 1;
                    }
                    best = Math.min(best, lo);
                }
            }
            out.println(best);
        }

        public boolean can2(int target, int have) {
            int tot = 0;
            for (int j : leaves) {
                int add = dist[s][j];
                if (solve(j, m - 1) + add >= target) {
                    int canadd = 1;
                    while (canadd < have && solve(j, m - canadd - 1) + add >= target) canadd++;
                    tot += canadd;
                }
            }
            return tot >= have;
        }

        public void dfs(int node, int par) {
            if (leaf[node]) leaves.add(node);
            count += cc[node];
            for (int next : graph[node]) {
                if (next == par) continue;
                dfs(next, node);
            }
        }

        public int solve(int node, int crim) {
            if (crim == 0) return 0;
            if (dp[node][crim] != -1) return dp[node][crim];
            int lo = 0, hi = MAXANS;
            while (lo < hi) {
                int mid = (lo + hi + 1) / 2;
                if (can(mid, node, crim)) lo = mid;
                else hi = mid - 1;
            }
            return dp[node][crim] = lo;
        }

        public boolean can(int target, int node, int crim) {
            int tot = 0;
            for (int j = 0; j < n; j++) {
                if (leaf[j] && j != node) {
                    int add = dist[node][j];
                    if (solve(j, crim - 1) + add >= target) {
                        int canadd = 1;
                        while (canadd < crim && solve(j, crim - canadd - 1) + add >= target) canadd++;
                        tot += canadd;
                    }
                }
            }
            return tot >= crim;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (this.numChars == -1) {
                throw new InputMismatchException();
            } else {
                if (this.curChar >= this.numChars) {
                    this.curChar = 0;

                    try {
                        this.numChars = this.stream.read(this.buf);
                    } catch (IOException var2) {
                        throw new InputMismatchException();
                    }

                    if (this.numChars <= 0) {
                        return -1;
                    }
                }

                return this.buf[this.curChar++];
            }
        }

        public int nextInt() {
            int c;
            for (c = this.read(); isSpaceChar(c); c = this.read()) {
                ;
            }

            byte sgn = 1;
            if (c == 45) {
                sgn = -1;
                c = this.read();
            }

            int res = 0;

            while (c >= 48 && c <= 57) {
                res *= 10;
                res += c - 48;
                c = this.read();
                if (isSpaceChar(c)) {
                    return res * sgn;
                }
            }

            throw new InputMismatchException();
        }

        public static boolean isSpaceChar(int c) {
            return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
        }

    }

    static class LUtils {
        public static <E> List<E>[] genArrayList(int size) {
            return Stream.generate(ArrayList::new).limit(size).toArray(List[]::new);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            TaskE.Vertex[] v = new TaskE.Vertex[n];
            for (int i = 0; i < n; ++i) {
                v[i] = new TaskE.Vertex();
            }
            for (int i = 0; i < n - 1; ++i) {
                TaskE.Vertex a = v[in.nextInt() - 1];
                TaskE.Vertex b = v[in.nextInt() - 1];
                long len = in.nextLong();
                TaskE.Edge ab = new TaskE.Edge(a, b, len);
                TaskE.Edge ba = new TaskE.Edge(b, a, len);
                ab.rev = ba;
                ba.rev = ab;
                a.edges.add(ab);
                b.edges.add(ba);
            }
            TaskE.Vertex police = v[in.nextInt() - 1];
            int m = in.nextInt();
            for (int i = 0; i < m; ++i) {
                ++v[in.nextInt() - 1].startCount;
            }
            for (TaskE.Vertex u : v) {
                for (TaskE.Edge e : u.edges) {
                    e.res = new long[m + 1][m + 1];
                    for (long[] x : e.res) Arrays.fill(x, -1);
                }
            }
            police.findSubtreeSums(null);
            long res = Long.MAX_VALUE;
            for (TaskE.Edge e : police.edges)
                if (e.dst.subtreeSum > 0) {
                    res = Math.min(res, e.solve(m, e.dst.subtreeSum));
                }
            out.println(res);
        }

        static class Edge {
            TaskE.Vertex src;
            TaskE.Vertex dst;
            TaskE.Edge rev;
            long[][] res;
            long len;

            public Edge(TaskE.Vertex src, TaskE.Vertex dst, long len) {
                this.src = src;
                this.dst = dst;
                this.len = len;
            }

            public long solve(int totalRemaining, int inSubtree) {
                if (totalRemaining == 0) return 0;
                if (res[totalRemaining][inSubtree] >= 0) return res[totalRemaining][inSubtree];
                boolean any = false;
                long[] worst = new long[totalRemaining + 1];
                Arrays.fill(worst, -1);
                worst[0] = Long.MAX_VALUE;
                for (TaskE.Edge e : dst.edges) {
                    if (e.dst != src) {
                        any = true;
                        for (int before = worst.length - 1; before >= 0; --before)
                            if (worst[before] >= 0) {
                                for (int here = 1; before + here <= totalRemaining; ++here) {
                                    long got = e.solve(totalRemaining, here);
                                    worst[before + here] = Math.max(worst[before + here], Math.min(worst[before], got));
                                }
                            }
                    }
                }
                if (!any) {
                    for (int a = 1; a <= totalRemaining; ++a) {
                        res[totalRemaining][a] = len + rev.solve(totalRemaining - a, totalRemaining - a);
                    }
                } else {
                    for (int a = 1; a <= totalRemaining; ++a) {
                        res[totalRemaining][a] = len + worst[a];
                    }
                }
                return res[totalRemaining][inSubtree];
            }

        }

        static class Vertex {
            int startCount;
            int subtreeSum;
            List<TaskE.Edge> edges = new ArrayList<>();

            public void findSubtreeSums(TaskE.Vertex parent) {
                subtreeSum = startCount;
                for (TaskE.Edge e : edges)
                    if (e.dst != parent) {
                        e.dst.findSubtreeSums(this);
                        subtreeSum += e.dst.subtreeSum;
                    }
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}