CNZ need to eat energy generated by energy stones., the stone's energy stops increasing once it reach. Each time he absorbs the energy of a continuous interval of stone. For example, if CNZ absorbs the energy of [S, T] stones, all energy stones numbered from. Twill become zero units of energy. CNZ can get the sum of energy in this range.What's the total amount of energy CNZ has eaten after
CNZ lives in the forest, and he has N N energy stones, numbered from 1 1 to N N . CNZ need to eat energy generated by energy stones. The i-th i−th energy stone initially contains E_i E i units of energy and will increase L_i L i units of energy each second. The maximum energy of i-th i−th energy stone is C_i C i , the stone's energy stops increasing once it reach C_i C i . Each time he absorbs the energy of a continuous interval of stone. For example, if CNZ absorbs the energy of [S, T] stones, all energy stones numbered from S S to T T will become zero units of energy. CNZ can get the sum of energy in this range. CNZ will eat M M times. The i-th eating happens after t_i t i seconds, and eat interval is [S_i, T_i] [S i ,T i ]. What's the total amount of energy CNZ has eaten after M M eating.