You are given a tree with $$$N$$$ vertices numbered $$$1, 2, \ldots N$$$. The $$$i-$$$th vertex has a color $$$C_i$$$. Each edge of the tree has some positive weight. Let's define the value of a pair $$$(x, y)$$$ of distinct vertices $$$x$$$ and $$$y$$$ as the sum of the weights of the edges that appear on the unique simple path between $$$x$$$ and $$$y$$$. Let's call such a pair valid if $$$x$$$ and $$$y$$$ have different colors. You want to select some ($$$\geq 0$$$) valid pairs of vertices, such that each vertex is contained in at max one pair, and the sum of values of all the selected pairs is maximized. Print this maximum value.
Constraints
For each testcase, print the answer on a new line.
2 4 1 1 2 2 1 2 3 2 3 1 2 4 5 2 1 1 1 2 1
9 0