You are given a tree with vertices. Initially, the number written on every vertex is .
For each vertex, you may perform the following operation at most once.
Choose one vertex and change the number written on it to the minimum number written on an adjacent vertex, plus .
If the chosen vertex has no adjacent vertices, the minimum number among adjacent vertices is considered to be .
Find the maximum possible sum of all numbers written on the tree after performing operations in a suitable order.
The input is given in the following format.
Print the maximum possible sum of all numbers written on the tree.
Performing the operation on the only vertex changes its number to .
First perform the operation on vertex , making it . Then perform the operation on vertices and , making both of them . The sum is .
The given graph is a tree with vertices. The vertices are numbered from to .
First perform the operation on vertex , making it . Then perform the operation on vertices , making all three of them . The sum is .