Roadblock

No attempts yetTime limit1sMemory limit128 MB

Problem

Every morning FJ wakes up and walks across the farm from his house to the barn. The farm is a collection of NN fields (1N2501 \le N \le 250) connected by MM bidirectional pathways (1M25,0001 \le M \le 25{,}000), each with a length. FJ's house is in field 1 and the barn is in field NN. No pair of fields is joined by more than one pathway, and any field can be reached from any other field along some sequence of pathways. When FJ travels from one field to another he always picks a route whose total length is minimum.

FJ's cows, up to no good as always, have decided to interfere with his morning routine. They will pile hay bales on exactly one of the MM pathways, doubling that pathway's length. The cows pick the pathway to block so that FJ's distance from the house to the barn grows as much as possible. Work out how much longer they can make his route.

Input

  • Line 1: two space separated integers NN and MM.
  • Lines 2 to 1+M1+M: line j+1j+1 describes the jjth bidirectional pathway with three space separated integers AjA_j, BjB_j, LjL_j. AjA_j and BjB_j are indices in the range 11 to NN naming the two fields the pathway joins, and LjL_j is the length of the pathway, in the range 11 to 1,000,0001{,}000{,}000.

Output

  • Line 1: the maximum possible increase in the total length of FJ's shortest route that doubling the length of a single pathway can produce.