Two Paths

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

문제

You are given an undirected graph with nn nodes (numbered from 11 to nn) and mm edges. Each edge has a length. The graph contains neither multiple edges nor self-loops.

Alice and Bob are now trying to play a game. Each player has to pick a path from 11 to nn (not necessary a simple path). The paths have to be different.

Alice always moves first, and she is so clever that she took one of the shortest paths from 11 to nn. Now is Bob's turn. Bob wants to pick the shortest possible path from 11 to nn which is different from Alice's path. Your task is to find the length of such path.

Two paths SS and TT are considered different if and only if they have different number of edges or there is an integer ii such that the ii-th edge of SS differs from the ii-th edge of TT.

입력

The first line of input contains two integers: the number of nodes nn and the number of edges mm (2n1052 \le n \le 10^5, 1m1051 \le m \le 10^5). Each of the next mm lines contains three integers aa, bb, and ww which mean that there is an edge between node aa and node bb, and its length is ww (1a,bn1 \le a, b \le n, 1w1091 \le w \le 10^9). It is guaranteed that there is at least one path from 11 to nn.

출력

Print a single line with a single integer: the length of a valid shortest path for Bob.