#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define inf 0x3f3f3f3f
#define N 2200
using namespace std;
inline char gc(){
static char now[1<<16],*S,*T;
if (T==S){T=(S=now)+fread(now,1,1<<16,stdin);if (T==S) return EOF;}
return *S++;
}
inline int read(){
int x=0;char ch=gc();
while(ch<'0'||ch>'9') ch=gc();
while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=gc();}
return x;
}
int num=1,T,h[N],pre[N],path[N],dis[N],fa,fb,f,a,b,n;bool flag[N];
struct node{
int x,y,z,next,c;
}data[N*N];
inline void insert1(int x,int y,int z,int c){
data[++num].y=y;data[num].next=h[x];h[x]=num;data[num].z=z;data[num].c=c;data[num].x=x;
data[++num].y=x;data[num].next=h[y];h[y]=num;data[num].z=0;data[num].c=-c;data[num].x=y;
}
inline bool spfa(){
memset(dis,0x3f,sizeof(dis));memset(flag,0,sizeof(flag));queue<int>q;q.push(0);flag[0]=1;dis[0]=0;memset(pre,-1,sizeof(pre));
while(!q.empty()){
int x=q.front();q.pop();flag[x]=0;
for (int i=h[x];i;i=data[i].next){
int y=data[i].y,z=data[i].z,c=data[i].c;
if(dis[x]+c<dis[y]&&z){
dis[y]=dis[x]+c;pre[y]=x;path[y]=i;
if(!flag[y]) flag[y]=1,q.push(y);
}
}
}if (pre[T]==-1)return 0;else return 1;
}
int main(){
freopen("bzoj1221.in","r",stdin);
n=read();a=read();b=read();f=read();fa=read();fb=read();T=n*2+1;
for (int i=1;i<=n;++i){
int s=read();insert1(0,i,s,0);insert1(i+n,T,s,0);insert1(0,i+n,inf,f);
if(i+a+1<=n) insert1(i,i+a+1+n,inf,fa);if(i+b+1<=n) insert1(i,i+b+1+n,inf,fb);if (i<n) insert1(i,i+1,inf,0);
}int ans=0;
// for (int i=2;i<=num;++i) printf("%d %d %d %d\n",data[i].x,data[i].y,data[i].z,data[i].c);
while(spfa()){
int minn=inf,now=T;
while(now) minn=min(minn,data[path[now]].z),now=pre[now];now=T;
while(now){ans+=minn*data[path[now]].c;data[path[now]].z-=minn;data[path[now]^1].z+=minn;now=pre[now];}
}printf("%d",ans);
return 0;
}