Given a tree containing **A** nodes rooted at node **1** .

Find the minimum value of the **sum** of **Distance(1, i)** where i varies from **1** to **A** using atmost **C** operations. In other words, find the minimum value of **Distance(1, 1) + Distance(1, 2) + Distance(1, 3) … upto Distance(1, n)** using atmost **C** operations.

In one **operation** you can change the weight of any edge to zero.

Nodes are connected by **A-1** edges. Given an array **B** where **B[i][0]** (0-indexed) is connected to node **B[i][1]** with edge of weight **B[i][2]** .

**NOTE:**

- Distance between node 1 and node i = Sum of weight of edges between them.
- The global variables need to be cleared because the code will run for multiple test cases.
- Return your answer modulo 109 + 7.

A = 5

B = [

[1, 2, 10]

[1, 3, 5]

[1, 4, 9]

[2, 5, 11]

]

C = 0

Given Tree:

1

/

2 3

/

4 5

Change the weight of edge connecting 1, 2 to 0.

Sum = Distance(1, 1) + Distance(1, 2) + Distance(1, 3) + Distance(1, 4) + Distance(1, 5).

= 0 + 0 + 5 + 3 + 14 = 22.

The contest is closed