Question
Money Heist
A boy is planning a heist in the bank. He is planning to hijack the bank for D days and print the money. The initial rate of printing the currency is P dollars per day and they increase the production by Q dollars after every interval of d days. For example, after d days the rate is P+Q dollars per day, and after 2d days the rate is P+2Q dollars per day, and so on. Output the amount of money they will be able to print in the given period.
Input
The only line of test case contains four space separated integers D, d, P, Q respectively.

Constraints
1 ≤ d ≤ D ≤ 106
1 ≤ P, Q ≤ 106
Output
Return the amount of money he will be able to print in the given period.
Example
Sample Input
2 1 1 1
Sample Output
3
Explanation
On the first day, the rate of production is 1 dollar per day so 1 dollar is printed on the first day.
On the second day, the rate of production is 1+1=2 dollars per day so 2 dollars are printed on the second day.
The total amount of money printed in 2 days is 1+2=3 dollars.

Online