A famous travel and tourism company succeed to win a new discount coupon, The coupon is only allowed to be used in the Treeland. In case you haven't heard about Treeland yet, Treeland is a city that has $$$n$$$ tourist places, the roads between these tourist places are specific which means you can move from a tourist place to another if and only if there is a road between them, Every road has a cost $$$w_i$$$ and you have to pay $$$w_i$$$ $$$sp$$$ for traveling using the $$$i-th$$$ road, there are $$$n - 1$$$ road between all tourist places in total and it's guaranteed that you can go from any tourist place to any other tourist place throughout a finite sequence of roads, that is, the $$$n$$$ tourist places form a weighted connected tree.
The discount coupon can be used as follows: The travel and tourism company can choose a set $$$S$$$ of $$$k$$$ tourist places, and for every road $$$i$$$ that lies on the shortest path between two nodes $$$u$$$ and $$$v$$$ such that $$$u \in S$$$ and $$$v \in S$$$, the company can travel using this road for free for one month.
The company has a schedule of $$$m$$$ trips for the next month and it wants to use the coupon to achieve the biggest discount, asking you to choose the set $$$S$$$ optimally for them.
The trip starts at some node $$$u$$$ and finishes at some node $$$v$$$ and it passes on every other node that lies on the shortest path between nodes $$$u$$$ and $$$v$$$, and the cost of the trip is the total cost of roads which the trip uses them.
The $$$m$$$ trips run individually which means the second trip starts when the first trip finishes, the third trip starts when the second trip finishes, and so on.
You have to calculate the total cost of the $$$m$$$ trips if we have chosen the set $$$S$$$ optimally.
The first line in the input contains one integer $$$T$$$ the number of testcases.
The first line of each test case contains three integers $$$n$$$, $$$k$$$, $$$m$$$ $$$(1 \le n \le 10^{4})$$$ $$$(1 \le k \le min(n,1000))$$$ $$$(1 \le m \le 10^{5})$$$, the number of tourist places in Treeland, the size of the set $$$S$$$, and the number of the trips of the next month.
The following $$$n - 1$$$ lines of each test case have three integers $$$u$$$, $$$v$$$, and $$$w$$$ means that there is a road between $$$u-th$$$ tourist place and $$$v-th$$$ tourist place with a cost of $$$w$$$ $$$(1 \le w \le 1000)$$$.
Each of the following $$$m$$$ lines has two integers $$$u$$$ and $$$v$$$ means that there is a trip that starts from node $$$u$$$ and finishes in node $$$v$$$.
The output for each test case should contain one integer, The minimum total cost of all trips after choosing the set $$$S$$$ optimally.
15 1 52 3 255 3 73 4 31 3 101 13 44 31 11 4
19
15 2 63 4 25 3 31 3 103 2 52 41 12 44 41 32 3
4
| Name |
|---|


