Chef And Clothes

All submissions for this problem are available.
Problem Statement
Chef has a bucket with A pieces of clothes. Initially he and the bucket is at X = 0 , there is a rope on which he can put his clothes for drying. He can put his clothes at positive integer coordinates on the rope and atmost 1 clothe can be put at a point. Also he can carry atmost 1 clothe with him at a time.
Chef takes B units of energy to move by 1 unit in any direction. Chef also has to option to move to bucket to some position which takes C[N] * distance + D energy where N is the number of clothes remaining in the bucket.
Note that you cannot carry the bucket and place some clothes on the rope at the same time
Help chef in finding the minimum amount of energy needed to put all clothes on the rope.
Constraints
1 <= A <= 1000
1 <= B <= 10^{ 9 }
1 <= D <= 10^{ 9 }
1 <= C[i] <= 10^{ 9 } for 0 <= i <= A
Note that C[i] might be less then C[i + 1] because he is chef.
Input Format
The only line of input contains 3 integers A , B , D. The next line containts A + 1 integers where the i ^{ th } integer denotes the value of C[i  1].
Output Format
Print the minimum amount of energy needed
Sample Input
2 1 0
0 1 2
Output
3
Chef takes the bucket to X = 1 , takes 2 units of energy , then puts a clothe there and then takes another clothe to X = 2 taking 1 more unit of energy so total being 3 units.
Sample Input
4 1 0
0 1 2 3 4
Output
10
Chef takes the bucket to X = 1 , puts one clothe there , Takes the bucket to X = 2 and puts one clothe , takes bucket to X = 3 and puts a clothe there and finally takes the bucket to X = 4 and puts a clothe there . total energy being 4 * 1 + 3 * 1 + 2 * 1 + 1 * 1.
Sample Input
2 1 1
0 100000000 200000000
Output
4
Chef takes a clothe to 1 and returns to bucket at 0 and takes the clothe to 2 and puts it there.
Total energy = 1 + 1 + 2 = 4
Sample Input
3 4 1
4 2 1 3
Output
9
Author:  skullcrackers 
Tags  skullcrackers 
Date Added:  28092016 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, PAS fpc, PAS gpc, RUBY, PHP, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions