You start with an array containing all zeroes. You will be given some updates. Updates are in the form $$$L, R, A, B$$$. For each update, you have to add $$$A+(i-L)*B$$$ for each $$$L \leq i \leq R$$$. You will have to answer queries in the form $$$L, R$$$. For each query, you have answer what's the maximum element in $$$[L, R]$$$ range.
The range sum query version of this problem can be solved with segment tree with lazy propagation. However, I can't think of a way to solve this one.