#P6023. 走路
走路
Description
Xiao W plans to work out over the next days. Since he cannot walk too much and get exhausted (how could that happen), over these days he can walk at most steps in total.
To encourage Xiao W to walk, the app provides incentive rules. Each rule is of the form: “If on day you finish walking steps, then on day every subsequent step will give you an additional point.” Incentive rules can stack, meaning that for one step you may gain more than point.
Now Xiao W wants to know: what is the maximum total number of points he can get?
Input Format
The first line contains three integers , with meanings as above.
The next lines each contain two integers , describing an incentive rule as above.
Output Format
Output one integer, the maximum points that can be obtained after days.
5 1 3
1 0
1 2
1 4
9
Hint
Explanation for the sample:
There is only one plan: walk steps on the first day. The first and second steps each gain point, the third and fourth steps each gain points, and the fifth step gains points, for a total of points.
Constraints:
For of the testdata, .
For of the testdata, .
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号