#P1128. 「一本通 4.3 例 2」A Simple Problem with Integers

「一本通 4.3 例 2」A Simple Problem with Integers

image

输入样例

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

输出样例

15
34
32
33
50

数据范围与提示

image