{"raw_statement":[{"iden":"statement","content":"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!\n\nAs 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.\n\nAssuming pi equals 3, what is the circumference of the given tree?\n\nThe 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.\n\n$1 <= n <= 3 * 10^5$\n\nOutput a single integer: the circumference of the tree.\n\n"},{"iden":"input","content":"The 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 <= n <= 3 * 10^5$"},{"iden":"output","content":"Output a single integer: the circumference of the tree."},{"iden":"examples","content":"Input1\nOutput0\nInput3\n3 2\n2 1\nOutput6\nInput5\n4 2\n1 4\n5 4\n3 4\nOutput6\n"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T = (V, E) $ be a tree with $ n $ nodes and $ n-1 $ edges.  \nLet $ d(u, v) $ denote the shortest path distance (number of edges) between nodes $ u $ and $ v $ in $ T $.  \nLet $ \\text{diam}(T) = \\max_{u,v \\in V} d(u, v) $ be the diameter of the tree.\n\n**Constraints**  \n1. $ 1 \\le n \\le 3 \\times 10^5 $  \n2. The graph is a tree (connected, acyclic, undirected).\n\n**Objective**  \nGiven $ \\pi = 3 $, compute the circumference of the tree:  \n$$\n\\text{circumference} = \\pi \\cdot \\text{diam}(T) = 3 \\cdot \\text{diam}(T)\n$$  \nOutput this value as an integer.","simple_statement":"The circumference of a tree is 3 times its diameter.","has_page_source":false}