AtCoder Beginner Contest 210
翻译中…
Problem Statement
翻译中…
Takahashi is visiting a shop specializing in cabbage.
翻译中…
The shop sells cabbage for $X$ yen (Japanese currency) per head.
However, if you buy more than $A$ heads of cabbage at once, the $(A+1)$-th and subsequent heads will be sold for $Y$ yen per head.
(It is guaranteed that $Y \lt X$. See Sample Input/Output 1 for clarity.)
翻译中…
Print the amount of money needed to buy $N$ heads of cabbage.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 10^5$$1 \leq A \leq 10^5$$1 \leq Y \lt X \leq 100$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N A X Y
翻译中…
Output
翻译中…
Print the amount of money needed to buy $N$ heads of cabbage (as an integer).
翻译中…
样例
Input #1
5 3 20 15
Output #1
90
You need to pay $20$ yen for each of the $1$-st through $3$-rd heads of cabbage, and $15$ yen for each of the $4$-th and $5$-th heads of cabbage.
Thus, you need to pay a total of $20+20+20+15+15 = 90$ yen for the $5$ heads of cabbage.
Input #2
10 10 100 1
Output #2
1000
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。