#A. A - Cabbages

    传统题 1000ms 256MiB

A - Cabbages

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

A - Cabbages

Score : $100$ points

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:

NN AA XX YY

Output

Print the amount of money needed to buy $N$ heads of cabbage (as an integer).


5 3 20 15
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.


10 10 100 1
1000

2025寒假ATC码力训练营第八次练习

未参加
状态
已结束
规则
IOI
题目
6
开始于
2025-1-31 13:00
结束于
2025-1-31 14:30
持续时间
1.5 小时
主持人
参赛人数
5