SOLVE
LATER
There are \(m\) real estate agents in the city. There is a street containing \(n\) houses in a straight line and they are numbered from \(1\) to \(n\). The \( i^{th} \) agent sells the houses with numbers from \(I_i\) to \(r_i\) and gets \(c_i\) dollars as the commission fee.
Note: The \(i^{th}\) agent is paid either \(0\) or \(c_i\) dollars.
If you want to buy a house, then you are required to pay the commission to all the agents selling that house but each agent can be paid at most once.
If you want to buy exactly \(k\) houses in the city, then determine the minimum amount of money that you must pay in dollars.
Input format
Output format
In a single line, print one number that represents the minimum amount of money that you are required to pay to buy exactly \(k\) houses.
Constraints
\(1 \leq n \leq 2000\\ 1 \leq m \leq 10^{5}\\ 1 \leq k \leq n\\ 1 \leq l_i \leq r_i \leq n\\ 1 \leq c_i \leq 10^{9}\)
We can buy houses with numbers $$[5,6,9,10]$$. In this situation we have to pay only 5$. (paying the second agent)