Problem Statement
Snuke Inc. offers various kinds of services.
A payment plan called Snuke Prime is available.
In this plan, by paying $C$ yen (the currency of Japan) per day, you can use all services offered by the company without additional fees.
You can start your subscription to this plan at the beginning of any day and cancel your subscription at the end of any day.
Takahashi is going to use $N$ of the services offered by the company.
He will use the $i$-th of those services from the beginning of the $a_i$-th day until the end of the $b_i$-th day, where today is the first day.
Without a subscription to Snuke Prime, he has to pay $c_i$ yen per day to use the $i$-th service.
Find the minimum total amount of money Takahashi has to pay to use the services.
Constraints
$1 \leq N \leq 2 \times 10^5$$1 \leq C \leq 10^9$$1 \leq a_i \leq b_i \leq 10^9$$1 \leq c_i \leq 10^9$- All values in input are integers.
Input
Input is given from Standard Input in the following format:
N C
a_1 b_1 c_1
\vdots
a_N b_N c_N
Output
Print the minimum total amount of money Takahashi has to pay.
样例
2 6
1 2 4
2 2 4
10
5 1000000000
583563238 820642330 44577
136809000 653199778 90962
54601291 785892285 50554
5797762 453599267 65697
468677897 916692569 87409
163089627821228
5 100000
583563238 820642330 44577
136809000 653199778 90962
54601291 785892285 50554
5797762 453599267 65697
468677897 916692569 87409
88206004785464
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。