#3220. 最优贸易

最优贸易

说明


输入格式

输出格式

一个整数,表示最多能赚取的旅费。如果没有进行贸易,则输出 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow></semantics></math>0

样例

5 5 
4 3 5 6 1 
1 2 1 
1 4 1 
2 3 2 
3 5 1 
4 5 2
5

提示