#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 qq millimeters every second.

Akihabara has nn locations, numbered from 11 to nn. Each location initially has a snow depth of hih_i.

There are mm bidirectional roads connecting these locations, and their lengths are wiw_i meters.

The snow is too heavy and public transportation has stopped, so Kotori has to walk home. Her walking speed is 11 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 lil_i in millimeters. If, upon arrival, the snow depth there is greater than lil_i, she will be trapped at that location and cannot leave, and thus cannot reach Kotori's home.

The dessert shop is location ss, and Kotori's home is location tt.

Do not consider the snow at the dessert shop and at Kotori's home.

Kotori wants to get home within gg seconds, as fast as possible. If she cannot reach home within gg seconds, or she gets trapped on the way, then she will turn wtnap into her snack ( ・ 8 ・ ).

Input Format

The first line contains 66 integers, separated by spaces: nn, mm, ss, tt, gg, qq.

The next nn lines each contain 22 integers, separated by spaces, representing hih_i and lil_i for that location.

The next mm lines each contain 33 integers, separated by spaces, representing the two locations uu, vv connected by the road and the road length wiw_i.

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 0%0\% of the testdata, the same as the sample.
For 40%40\% of the testdata, q=0q = 0.
For 50%50\% of the testdata in the previous line, all wi<liw_i < l_i.
For 100%100\% of the testdata, 1s,tn1 \le s, t \le n; 0g,q1090 \le g, q \le 10^9; 0wili1090 \le w_i \le l_i \le 10^9.

Translated by ChatGPT 5