|Problems||Submit||Runs Status||Rank List||Statistics||Clarifications|
“More lumber is required” When the famous warcrafts player Sky wants to build a Central Town, he finds there is not enough lumber to build his Central Town. So he needs to collect enough lumber. He lets farmer John to do this work.
There are several Sawmills have already been built in the world, around them are large forests. Sawmills are connected by bidirectional roads (a sawmill can be connected to itself). When he passes a road, he will get 10 lumber and consume a certain time. Sky needs K lumber. So John needs collect as least K lumber.
Sawmills are labeled from 1 to N. John initiates at Sawmill S. When he finishes his work, Sky gives him another work: arrive at Sawmill T, and build the Central Town. John needs to design his route carefully because Sky wants to build this Central Town as early as possible. He turns you for help. Please help him calculate the minimum time he needs to finish this work (collect enough lumber and build the Central Town). If impossible just print -1.
You can read the Sample Input and Output for more information.
There are multiply test cases, in each test case:
The first line is two integers N (1<=N<=5000), M (0<=M<=100000) represent the number of sawmills and the number of the roads.
The next M line is three integers A B C (1<=A, B<=N; 1<=C<=100), means there exists a road connected Ath sawmill and Bth sawmill, and pass this road will cost C time.(The sawmills are labeled from 1 to N).
The last line is three integers S T K (1<=S, T<=N; 0<=K<=500), as mentioned as description.
For each test case, print the result in a single line.
1 2 1
2 3 2
1 3 100
3 4 1
1 3 50