CSES - Flight Discount
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Your task is to find a minimum-price flight route from Syrjälä to Metsälä. You have one discount coupon, using which you can halve the price of any single flight during the route. However, you can only use the coupon once.

When you use the discount coupon for a flight whose price is xx, its price becomes x/2\lfloor x/2 \rfloor (it is rounded down to an integer).

Input

The first input line has two integers nn and mm: the number of cities and flight connections. The cities are numbered 1,2,,n1,2,\ldots,n. City 1 is Syrjälä, and city nn is Metsälä.

After this there are mm lines describing the flights. Each line has three integers aa, bb, and cc: a flight begins at city aa, ends at city bb, and its price is cc. Each flight is unidirectional.

You can assume that it is always possible to get from Syrjälä to Metsälä.

Output

Print one integer: the price of the cheapest route from Syrjälä to Metsälä.

Constraints

  • 2n1052 \le n \le 10^5
  • 1m21051 \le m \le 2 \cdot 10^5
  • 1a,bn1 \le a,b \le n
  • 1c1091 \le c \le 10^9

Example

Input:

3 4
1 2 3
2 3 1
1 3 7
2 1 5

Output:

2