Telephone Lines#10153

Telephone Lines

1 second
128 megabytes
Easy

Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he must pay for some of the cables needed to connect his farm to the telephone system.

There are forlorn telephone poles, conveniently numbered from to , scattered around Farmer John's property; no cables currently connect any of them. A total of pairs of poles can be connected by a cable; the remaining pairs are too far apart.

The -th cable can connect two distinct poles a_i and b_i with a length of l_i~(1 \le l_i \le 10^6) units. Each pair {a_i,b_i} appears at most once in the input.

Pole is already connected to the telephone system, while pole is located at the farm. Poles and must be connected by a path of cables; the remaining poles may or may not be used.

The phone company is willing to provide Farmer John with cable lengths for free. Beyond those free cables, Farmer John must pay a price equal to the length of the longest remaining cable he needs to use, or if no additional cables are required.

Determine the minimum amount Farmer John must pay.

Input

The first line contains three integers , and k~(1 \le n \le 1000, 1 \le p \le 10000, 0 \le k < n).

Each of the next lines contains three integers a_i, b_i, and l_i.

Output

Print one integer: the minimum amount Farmer John must pay. If it is impossible to connect the farm to the telephone system, print .

Examples

Example 1

Loading
Loading