#P3946. ことりのおやつ(小鸟的点心)
ことりのおやつ(小鸟的点心)
Description
It is the winter of 2017. (It is the season of White Album again 2333.)
After skiing, Kotori suddenly wants a snack, so she goes to a dessert shop.
It often snows in winter in Japan. Unfortunately, today is the same, and the snow depth increases by millimeters every second.
Akihabara has locations, numbered from to . Each location initially has a snow depth of .
There are bidirectional roads connecting these locations, and their lengths are meters.
The snow is too heavy and public transportation has stopped, so Kotori has to walk home. Her walking speed is m/s.
For convenient mapping, the road network ensures that each road strictly connects two different locations, and there are no two roads connecting the same pair of locations.
Each location has a limit snow height in millimeters. If, upon arrival, the snow depth there is greater than , she will be trapped at that location and cannot leave, and thus cannot reach Kotori's home.
The dessert shop is location , and Kotori's home is location .
Do not consider the snow at the dessert shop and at Kotori's home.
Kotori wants to get home within seconds, as fast as possible. If she cannot reach home within seconds, or she gets trapped on the way, then she will turn wtnap into her snack ( ・ 8 ・ ).
Input Format
The first line contains integers, separated by spaces: , , , , , .
The next lines each contain integers, separated by spaces, representing and for that location.
The next lines each contain integers, separated by spaces, representing the two locations , connected by the road and the road length .
Output Format
Output one line with one integer, the shortest time to reach Kotori's home.
If wtnap becomes Kotori's snack, output "wtnap wa kotori no oyatsu desu!" without quotes.
2 1 1 2 10 1
1 10
3 10
1 2 6
6
5 6 2 5 10 1
1 10
1 10
1 10
1 10
1 10
1 5 9
1 3 9
2 4 1
2 5 9
3 4 1
3 5 6
8
5 6 2 5 10 1
1 10
1 10
10 10
1 10
1 10
1 5 9
1 3 9
2 4 1
2 5 11
3 4 1
3 5 6
wtnap wa kotori no oyatsu desu!
Hint
For of the testdata, the same as the sample.
For of the testdata, .
For of the testdata in the previous line, all .
For of the testdata, ; ; .

Translated by ChatGPT 5
京公网安备 11011102002149号