文理学院程序设计在线练习


Optimum allocation

Time Limit: 2 Second(s)    Memory Limit: 128 MB

Total Submission(s): 0   Accepted Submission(s): 0
Problem Description

One company have a project which need n days to complete. In i-th day, the company need Ci workers.Due to the strict requierments of production envirnment, workers must wear special uniform to work, but this uniform needs to be sterilized after been worn for one day(if you wear it on day i, you can’t sterilize it on day i). There are two ways to sterilize.First way, we need a days (if you sterilize it on day i, it can be worn on day a+i)to sterilize one and the cost is fa yuan. Another way will need b days to sterilize a uniform and the cost is fb yuan. Buy a new uniform(can be worn right now) need f yuan. Of course, the company need to know the minimum cost.

Input

The input consists of several test cases, for each input
First line:n, a, b, f, fa, fb.(1<=n<=1000, b>a, 1<=fb<fa<f<=60)
Second line: c1, c2, c3, c4, ……, cn. (1<=cn<=1000)
All numbers are integer.

Output

For each test case, print in a single line a number, which is the minimum cost.

Sample Input
4 1 2 3 2 1
8 2 1 6
Sample Output
38
Source

2017绍兴市技能竞赛