1 #include <iostream>
2 #include <cstdlib>
3 #include <cstdio>
4 #include <cstring>
5 #include <queue>
6 #include <algorithm>
7 #include <cmath>
8 #include <map>
9 #include <set>
10 #define N 100005
11 using namespace std;
12 int n,va1,va2,t1,t2,bu,t[N],a[N];
13 int sum,mx,q[N],hea,en;
14 int check(int x)
15 {
16 hea=1,en=0;
17 memset(q,0,sizeof(q));
18 memcpy(a,t,sizeof(t));
19 int ans=x*bu;
20 for(int i=1;i<=n;i++)
21 {
22 if(i>t2)
23 {
24 en++;
25 q[en]=i-t2;
26 }
27 if(t[i]<=x)
28 {
29 x-=t[i];
30 continue;
31 }
32 for(int j=t[i]-x;j;)
33 {
34 if(en<hea)return 0x7fffffff;
35 if(q[hea]<=i-t1)
36 {
37 int k=min(a[q[hea]],j);
38 a[q[hea]]-=k,j-=k;
39 ans+=va1*k;
40 if(!a[q[hea]])hea++;
41 }
42 else
43 {
44 int k=min(a[q[en]],j);
45 a[q[en]]-=k,j-=k;
46 ans+=va2*k;
47 if(!a[q[en]])en--;
48 }
49 }
50 if(x)x=0;
51 }
52 return ans;
53 }
54 int main()
55 {
56 scanf("%d%d%d%d%d%d",&n,&t1,&t2,&va1,&va2,&bu);
57 for(int i=1;i<=n;i++)
58 {
59 scanf("%d",&t[i]);
60 sum+=t[i];
61 mx=max(mx,t[i]);
62 }
63 if(va1>va2)swap(va1,va2),swap(t1,t2);
64 int li=mx,ri=sum;
65 while(li<ri-10)
66 {
67 int lmid=(li*2+ri)/3,rmid=(li+ri*2)/3;
68 int ans1=check(lmid),ans2=check(rmid);
69 if(ans1<ans2)ri=rmid;
70 else li=lmid;
71 }
72
73 int ans=0x7fffffff;
74 for(int i=li;i<=ri;i++)
75 {
76 ans=min(check(i),ans);
77 }
78 printf("%d\n",ans);
79 return 0;
80 }