Link is the owner of a railway company. The railway company currently operates

stations and

railway lines.
The railway network consists of

bidirectional railways, and any two stations can be reached from each other through the railway network. The railways in the network can be represented by

triplets
)
, where

and

are the starting and ending stations of the railway, and

is the daily maintenance cost for that railway.
The operated transport lines of the company can be represented by

quadruplets
)
. Here,

and

are the starting and ending stations of the line,

represents the daily revenue generated by the line, and

represents the additional expenses incurred by operating this line daily.
The company is currently undergoing a reform: abandoning some underperforming lines and stopping maintenance on certain railways to improve the company's profitability.
Link wants to know, in the optimal state, what is the maximum daily revenue the company can achieve after the reform?
输入描述:
The first line contains two integers,
and
.
The next
lines contain three integers each,
,
, and
, representing a railway.
The next
lines contain four integers each,
,
,
, and
, representing a transport line operated by the company.
It is guaranteed that any two stations can be reached from each other through the railway network.
输出描述:
Output a single integer on a line, representing the maximum daily revenue.
示例1
输入
复制
3 2
1 2 2
1 3 2
2 3 2 1
1 2 4 1