P8822 [Chuanzhi Cup #3 Preliminary] Course Enrollment
Description
Chuanzhi Podcast has launched a course and ran a promotion. Specifically, the course starts with a price of $v$ yuan; for every $m$ students who enroll, the course price increases by $a$ yuan. Since the course can only take a limited number of students, enrollment stops when the number of enrolled students reaches $n$.
Now the teacher wants to know: when enrollment stops, how much tuition fee can be collected in total?
Input Format
One line with four integers separated by spaces: $n, v, m, a$.
Output Format
One line with one integer, representing the answer.
Explanation/Hint
### Sample Explanation
For each course sold, the price increases by $1$ yuan, so the total revenue is $1+2+3+4+5=15$ yuan.
### Constraints
For $50\%$ of the testdata, $1 \leq n, m, v, a \leq 10$.
For an additional $20\%$ of the testdata, $a = 0$.
For $100\%$ of the testdata, $0 \leq n, m, v, a \leq 1000$.
However, since this contest uses the ACM format, you must pass $100\%$ of the testdata to get the score for this problem, and the same applies to the later problems.
Translated by ChatGPT 5