- Time limit: 1.00 s
- Memory limit: 512 MB
In order to attract more visitors, the manager of a national park had the idea of planting flowers along both sides of the popular trails, which are the trails used by common people. Common people only go from the park entrance to its highest peak, where views are breathtaking, by a shortest path. So, he wants to know how many metres of flowers are needed to materialize his idea.
Given a description of the park, with its points of interest and (two-way) trails, the goal is to find out the extent of flowers needed to cover both sides of the popular trails. It is guaranteed that, for the given inputs, there is some path from the park entrance to the highest peak.
Input
The first line of the input has two integers: and . is the number of points of interest and is the number of trails. Points are identified by integers, ranging from to . The entrance point is 1 and the highest peak is point .
Each of the following lines characterises a different trail. It contains three integers, , and , which indicate that a (two-way) trail links directly points and (not necessarily distinct) and has length (in metres).
Output
Output a single line with the extent of flowers (in metres) needed to cover both sides of the popular trails.
Constraints
Examples
Input:
4 7 1 2 1 1 3 2 1 4 10 1 4 3 2 4 2 3 4 1 2 2 1
Output:
18
Input:
10 15 1 2 580 2 5 90 2 5 90 5 10 250 5 3 510 3 8 600 8 4 200 4 4 380 4 1 150 1 4 100 8 9 500 8 10 620 10 7 510 7 6 145 6 10 160
Output:
3860