Heracles

아직 제출이 없습니다시간 제한2초메모리 제한64 MB

문제

In Ancient Greece there are nn cities which are connected by mm bidirectional roads. It is possible to reach any city from another one my moving via the roads (maybe through several transitional cities). There is at most one road between any two cities and each road connects two distinct cities. Road ii has length c_ic\_i.

Heracles urgently has to make 1212 labours as directed by the king Eurystheus. The labours should be made in 1212 certain cities of Ancient Greece. Currently Heracles is in city Mycenae which is not among these 1212 cities. To make the labours as fast as possible, Heracles wants to develop an optimal travel plan, according to which he must  visit the 1212 necessary cities and returns to Mycenae in minimal possible time.

Help Heracles to determine the minimal time for the travel. Heracles passes a road of length c_ic\_i in time c_ic\_i. Every road can be passes an arbitrary number of times in any direction, and any city can be visited an arbitrary number of times. The order of visiting the cities is irrelevant. Time for making the labours does not need to be taken into account.

입력

The first line contains integers nn and mm (13n10513 \le n \le 10^5, n1mmin(n(n1)2,105)n-1 \le m \le \min(\frac{n(n-1)}{2}, 10^5)).

The following mm lines describe the roads. The ii-th of them has form <<a_ia\_i b_ib\_i c_ic\_i>> which means that the ii-th road connects cities with numbers a_ia\_i and b_ib\_i, and has length c_ic\_i (1a_i,b_in1 \le a\_i, b\_i \le n, a_ib_ia\_i \ne b\_i, 1c_i10001 \le c\_i \le 1000). It is guaranteed that there is at most one road between any two cities, and that it's possible to reach each city from any another city.

Mycenae has number 11, and cities where Heracles have to make the labours have numbers from 22 to 1313.

출력

Output one integer --- the minimum possible time of the travel.

힌트

One of the optimal travel plans for the sample: 1234321145871 \to \mathbf{2} \to \mathbf{3} \to \mathbf{4} \to 3 \to 2 \to 1 \to 14 \to \mathbf{5} \to \mathbf{8} \to \mathbf{7} \to 69101110151213141.\to \mathbf{6} \to \mathbf{9} \to \mathbf{10} \to \mathbf{11} \to 10 \to 15 \to \mathbf{12} \to \mathbf{13} \to 14 \to 1.