ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

1934. Black Spot

Time limit: 1.0 second
Memory limit: 64 MB
Bootstrap: Jones's terrible leviathan will find you and drag the Pearl back to the depths and you along with it.
Jack: Any idea when Jones might release said terrible beastie?
Bootstrap: I already told you, Jack. Your time is up. It comes now, drawn with ravenous hunger to the man what bears the black spot.
Captain Jack Sparrow has got a black spot on his hand and he avoids going to high seas because sea monster Kraken is waiting there for him. But he can’t stay in his place due to his freedom-loving nature. And now Jack is going to Tortuga.
There are n islands in the Caribbean Sea. Jack is going to reach Tortuga, sailing from island to island by routes that allow him to be in the high seas for a short time. Jack knows such routes for some pairs of islands, but they could also be dangerous for him. There is a probability to meet Kraken on each route.
Jack is in a hurry and he wants to reach Tortuga visiting as small number of islands as possible. If there are several variants of such paths he wants to choose a path with the least probability of meeting Kraken. But Jack will be satisfied with any path with minimal number of islands if the probability of meeting Kraken on this path differs from the minimal one in no more than 10−6. Help Jack find such path.


The first line contains two integers n, m — the quantity of islands and known routes between them (2 ≤ n ≤ 105; 1 ≤ m ≤ 105). The second line contains two integers s and t — the number of island where Jack is and the number of Tortuga (1 ≤ s, tn; st). Each of the following m lines contains three integers — the numbers of islands ai and bi where the route is known and pi — probability to meet Kraken on that route as percentage (1 ≤ ai, bin; aibi; 0 ≤ pi ≤ 99). No more than one route is known between each pair of islands.


In the first line output k — number of islands along the path and p — probability to meet Kraken on that path. An absolute error of p should be up to 10−6. In the next line output k integers — numbers of islands in the order of the path. If there are several solutions, output any of them.


4 4
1 3
1 2 50
2 3 50
1 4 10
4 3 10
3 0.19
1 4 3
Problem Author: Denis Dublennykh (prepared by Egor Shchelkonogov)
Problem Source: Open Ural FU Championship 2012