Problem2712--NOI训练 - NOI2019D1T1回家路线

2712: NOI训练 - NOI2019D1T1回家路线

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description



Input

						

Sample Input Copy

3 4 1 5 10
1 2 3 4
1 2 5 7
1 2 6 8
2 3 9 10

Sample Output Copy

94

Source/Category