Problem B: 动态规划-最短路

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:56 Solved:30

Description

求顶点0到顶点n的最短路径

Input

第1行输入两个正整数n,m ,代表有n+1个点,m条边
第2行到第m+1行,每行输入三个数字,x,y,z分别代表每一条边的起点,终点和权值


Output

输出从点0到点n的最短路径

Sample Input Copy

3 4
0 1 4
0 2 3
1 3 2
2 3 2

Sample Output Copy

5