407024: GYM102694 A Circumference of a Tree
Description
Hopefully you know how to find the diameter of a tree. That's the first part of tree basics, after all! But this problem is completely different: now, you need to find the circumference of a tree!
As you probably know, pi is equal to the ratio between something's circumferance and its diameter. Also, as you may not know, math is a lie and pi is really equal to 3. Rumor has it, this is where the number tree(3) comes from.
Assuming pi equals 3, what is the circumference of the given tree?
InputThe first line will contain a single integer $$$n$$$, the number of nodes in the tree. $$$n-1$$$ lines follow, each containing two different integers, describing the edges of the tree. Additional constraint on input: these edges will form a tree.
$$$1 \leq n \leq 3*10^5$$$
OutputOutput a single integer: the circumference of the tree.
ExamplesInput1Output
0Input
3 3 2 2 1Output
6Input
5 4 2 1 4 5 4 3 4Output
6