Taxi

아직 제출이 없습니다시간 제한1.5초메모리 제한256 MB

문제

You are given an undirected tree on NN vertices. Each edge has a length, which is a strictly positive integer. MM taxis and MM customers will appear in this tree, each taxi and each customer appearing in exactly one node. It is possible that a node will contain multiple taxis and/or multiple customers.

A taxi-app will match customers with taxis. These days, the customer must pay for the distance that the taxi travels just to pick them up. The taxi-app is mischievously greedy, so it will match customers with taxis such that the total distance travelled by taxis to their respective customers is as high as possible. Note that each taxi gets assigned to exactly one customer and each customer is assigned to exactly one taxi.

There are N2MN^{2M} different ways in which the taxis and customers may appear in the tree. For each of these ways, we can find the total distance travelled by taxis according to the mischievously greedy matching picked by the taxi-app. Your task is to add all these distances together and compute this sum modulo 109+710^9 + 7.

입력

The first line contains two integers, NN and MM (1N,M25001 \le N, M \le 2500).

Each of the next N1N - 1 lines contains three integers: xx, yy and ll. This means that there exists an undirected edge between nodes xx and yy of length ll (1l10,0001 \le l \le 10\\,000). It is guaranteed that the given edges form a tree.

출력

Print a single line containing a single integer: the required sum modulo 109+710^9 + 7.