No.2150 Site Supporter
Problem Statement
In the year 29XX, Yukicoder has become a paid service.
Users other than site supporters must now pay $1$ yen per $1$ problem in order to solve problems.
Each day, a user can choose whether or not to be a site supporter.
To be a site supporter, the user must pay a membership fee of $K$ yen per $1$ day, and, upon joining
(that is, when a person who was not a site supporter on the previous day becomes a site supporter on the next day),
an enrollment fee of $X$ yen.
Ramdos plans to solve past problems for $N$ days starting tomorrow, and he intends to solve $A_i$ problems on the day $i$ days from today.
As of today, Ramdos is not a site supporter. What is the minimum amount he must pay to achieve this goal?
Input
$N\ K\ X$ $A_1\ A_2\ \dots A_N$
- $1 \le N \le 2 \times 10^5$
- $1 \le K \le 10^9$
- $1 \le X \le 10^9$
- $1 \le A_i \le 10^9$
- All inputs are integers.
Output
Output the minimum amount that must be paid.
Sample
Sample 1
Input
4 3 5 2 9 8 1
Output
14
If he is a supporter from day $2$ through day $3$, he pays $14$ yen.
The payment cannot be made less than $14$ yen, so output $14$.
Sample 2
Input
18 3 5 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3
Output
55
Sample 3
Input
7 10 3 6 9 5 2 3 1 4
Output
30
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。