The Zerg, having held off the Protoss timing attack, is preparing to counterattack! However, they don't wish to be all that obvious, so they will not take the shortest path to the Protoss natural to counterattack. Instead, they will take the second-shortest path! It is guaranteed there are at least two paths with distinct lengths.
To be clear about what this means, we model the map the Zerg is on as an undirected weighted graph.
Let
Constraints
Input Specification
The first line will contain two integers,
Each of the next
Output Specification
Output the length of the second-shortest path.
Sample Input
4 4
1 2 100
2 4 200
2 3 250
3 4 100
Sample Output
450
Comments
don't know if this was intended but submitted a correct answer to https://dmoj.ca/problem/cco12p2 then copied and pasted the same answer to this and still passed