시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 0 0 0 0.000%

문제

Vasya's friends are always playing the same board game called "Pandemic". Vasya is tired of this game, so he has decided to create his own version.

He chooses $n$ cities on the map of Byteland and $n-1$ bidirectional roads that connect them. Cities are enumerated by integers from $1$ to $n$, and roads are enumerated by integers from $1$ to $n-1$. The $i$-th road has length of $l_{i}$ kilometers and connects cities $u_{i}$ and $v_{i}$. There is a path by the roads between any pair of the cities. During the game roads and cities become infected. A city can be either entirely infected, or not infected at all, and a road can contain both infected and not infected parts.

At the beginning of the game, the cities $a_1, a_2, \ldots, a_m$ become infected. Then the infection spreads along the adjacent roads. A city becomes infected at the moment when the infection reaches it. At the same time the infection begins to spread along roads adjacent to the city that has just been infected. The city becomes infected instantly, and the infection spreads along any road at the constant speed of one kilometer per minute.

At each moment of the game the yet uninfected cities and parts of roads form uninfected connected components. An uninfected city and adjacent uninfected parts of roads are always in the same component. Two uninfected cities are in the same component if and only if there is a path of uninfected roads that connects them. Uninfected connected component can contain no cities at all, in this case it consists of a single uninfected part of the road that connects already infected cities.

The game ends when all cities and roads become infected. Vasya has not yet come up with the roles for players, but first he wants to know what is the maximum number of uninfected connected components that would exist on the board at some moment of the game.

입력

The first line of input consists of one integer $n$ --- a number of chosen cities ($2 \le n \le 10^5$). The following $n-1$ lines contain descriptions of chosen roads, the $i$-th line contains three integers $u_i$, $v_i$ and $l_i$ --- the cities connected by the $i$-th road and its length ($1 \le u_i, v_i \le n$; $u_i \ne v_i$; $1 \le l_i \le 10^9$).

The next line contains one integer $m$ --- the number of cities, that are infected at the beginning of the game ($1 \le m \le n$). The next line contains $a_1, a_2, \ldots, a_m$ --- the numbers of these cities ($1 \le a_i \le n$, all $a_i$ are distinct).

출력

Print one integer --- the maximum number of uninfected connected components on the board at some moment of the game.

예제 입력 1

8
1 2 1
1 3 1
2 4 1
2 5 1
3 6 1
3 7 1
1 8 4
2
1 8

예제 출력 1

5