Given a weighted rooted tree with n vertices. Let's call simple path from u to v vertical iff and u is on simple path from root to v. The weight of the path is a sum of weights for all edges in the path. The mean weight of the path is a weight of the path divided by number of edges in it. Calculate mean weight of each vertical path, sort them and print k-th value in sorted order.
The first line of input contains two integers n and k (). It is guaranteed that there are at least k vertical paths in the given tree.
Next lines contain description of edges ().
The root of the tree is vertex 1.
Print the k-th minimal mean weight as an irreducible fraction.
10 points
10 points
, 15 points
10 points
25 points
30 points
These are the vertical paths in the given tree: , , , , and
Mean weights of the paths:
So, if we sort these values, we get: