404769: GYM101628 F Find the Inn
Description
On holidays, Bolado decided to go on an adventure. Bored with the urban life, he decided to travel to the mountains, where he'd have the time to discover new places and think in jokes. Upon his arrival, Bolado found himself surrounded by avast and dense forest, with trees of various types, which make his instincts lead him to the following thought.
"Why does the pine tree never gets lost in the woods?"
"Because he has a pine cone!"
(Read the statement in Portuguese to understand the joke)
Glad with the joke he made, Bolado could only think about it while looking for the inn. However, it didn't take too long until our beloved jokester noticed he was lost. Fortunately, he had a map of the area.
In the map there are N areas, numbered from 1 to N. Bolado is currently lost in the area 1 and the inn is in area N. There's also M directional paths which connect two distinct areas. Each path has also a description containing the time in minutes needed to cross it.
Additionally, because environmental preservation matters, P of the N areas have a pine tree. There are no pine trees in area 1 and area N. Whenever Bolado finds himself in one of these areas, he needs to stop and laugh for K seconds while remembering his master piece. There are T minutes left until the sun sets and Bolado wants to arrive at the inn ASAP (so he can think about inn related jokes).
InputThe first line contains five integers, N (2 ≤ N ≤ 3 * 104), M (0 ≤ M ≤ 105), T (0 ≤ T ≤ 5 * 107), K (1 ≤ K ≤ 5 * 107), P (0 ≤ P ≤ N - 2), as described above. Then follows P integers pi (). After, there are M lines describing each path with three integers xj, yj and wj, indicating that Bolado can go from area xj to area yj in wj minutes, for 1 ≤ j ≤ M (xj ≠ yj; 1 ≤ xj, yj ≤ N and 1 ≤ wj ≤ 105).
OutputPrint the minimum time Bolado can arrive at the inn. If he can't arrive before or at the same time the sun sets, print “-1” without the quotes.
ExamplesInput5 7 312 10 2Output
3 2
1 2 8
4 5 98
3 2 12
5 2 30
5 1 103
3 4 65
2 3 1
10340Input
4 6 29370 22446 1Output
3
4 2 32014
2 3 24
2 1 67
4 3 16
1 2 633
2 4 4298
295860Input
3 2 701 8561 1Output
2
2 1 346
3 1 9
-1