#P8822. [传智杯 #3 初赛] 课程报名

[传智杯 #3 初赛] 课程报名

Description

Chuanzhi Podcast has launched a course and ran a promotion. Specifically, the course starts with a price of vv yuan; for every mm students who enroll, the course price increases by aa yuan. Since the course can only take a limited number of students, enrollment stops when the number of enrolled students reaches nn.

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,an, v, m, a.

Output Format

One line with one integer, representing the answer.

5 1 1 1
15

Hint

Sample Explanation

For each course sold, the price increases by 11 yuan, so the total revenue is 1+2+3+4+5=151+2+3+4+5=15 yuan.

Constraints

For 50%50\% of the testdata, 1n,m,v,a101 \leq n, m, v, a \leq 10.

For an additional 20%20\% of the testdata, a=0a = 0.

For 100%100\% of the testdata, 0n,m,v,a10000 \leq n, m, v, a \leq 1000.

However, since this contest uses the ACM format, you must pass 100%100\% of the testdata to get the score for this problem, and the same applies to the later problems.

Translated by ChatGPT 5