#SDNU1224. Tom'problem B
Tom'problem B
Description
Tom is a student in Shan Dong Normal University! his University in the suburbs,this day,Tom wanted to go to the downtown to visit his old friend Jerry,But tom faced a problem ,he want to know how to reach the city center fastest,now the bus stations of city are , there are bus routes in the city
Tom in the st bus station,Jerry in the th bus station
Format
Input
The fist line is ;
Next lines is ( is the name of bus station , is the time you cost from station to station )
Output
The shortest time tom reach city center
Samples
1 2
1 2 10
3 4
1 2 10
2 3 10
3 4 10
10
30