You are given a weighted tree that contains N nodes and an integer K. You are required to remove some edges from the tree (the number of removed edges can also be zero). If you remove M−1 edges from the tree, then you can retrieve M different trees from the original tree. You have to make sure that each diameter of the tree is less than or equal to K. Determine the minimum value of M.
Note: Diameter of a weighted tree is defined to be the maximum sum of weights on a path over all simple paths in the tree.
Input format
Output format
Print a single integer denoting the minimum value of M on a line.
Constraints
2≤N≤500
1≤K≤500
1≤u,v≤N
1≤w≤500
We have to remove at least 3 edges from this tree, which will result in 4 trees. Note that there can be multiple ways to remove the minimum number of edges.