Kitten Kis has found a big tree in his yard. He wants to climb it, but the tree is too big! The tree he has found has nodes and edges. Each edge has a positive length. We define the distance between any two nodes as the sum of the lengths of the edges on a simple path between them. Additionally, we define the diameter of a tree as the biggest distance between any two nodes.
To climb the tree, Kis wants to make the tree diameter as small as possible. In order to achieve this he can do at most operations. For each operation he picks an edge in the tree that has non-zero length and then he decreases it by . Kis is just a small kitten so it asks for your help. Write the program kitten to find the smallest possible diameter that can be achieved by doing at most operations
Input data
The first line of the standard input contains the integers and . Then each of the last contains positive integers: describing an edge between nodes and of length .
Output data
Output one integer – the smallest possible diameter of the tree that can be achieved after at most operations.
Restrictions
| Subtask | Points | Required subtasks | |||
|---|---|---|---|---|---|
| 1 | 5 | ||||
| 2 | 5 | ||||
| 3 | 8 | ||||
| 4 | 22 | ||||
| 5 | 15 | ||||
| 6 | 15 | ||||
| 7 | 10 | ||||
| 8 | 20 |
Example 1
stdin
5 6
1 2 5
2 3 4
2 4 3
4 5 2
stdout
6
Explanation
Illustration of the tree and its diameter in the beginning:

After operations we can obtain tree with diameter , which is the smallest possible diameter even after operations:

Example 2
stdin
5 7
1 2 5
2 3 4
2 4 3
4 5 2
stdout
5
Example 3
stdin
5 0
1 2 5
2 3 4
2 4 3
4 5 2
stdout
10