Yudam and Woohyun are dating. Worried that Woohyun may be unfaithful, Yudam wants to monitor the places they often visit with CCTV cameras.
The connections between the places form a tree with vertices and edges. The distance between two vertices and is the number of edges on the unique simple path joining them.
Choose a nonnegative integer for every vertex .
Find the minimum possible total cost such that every vertex is monitored by at least one CCTV camera.
The input is given from Standard Input in the following format:
Print the minimum total cost required to monitor every vertex.
A CCTV camera of range at vertex monitors every vertex.
One valid placement uses range- CCTV cameras at vertices and .
For each (), there is an edge joining vertices and .
| 5 | 36 | No additional constraints. |
For example, a CCTV camera of range at vertex monitors every vertex.