#include<bits/stdc++.h>
using namespace std;
int main(){
int max_high = 0;
int step,w1,w2,h1,h2;
cin >> step>> w1>> w2>> h1>> h2;
int vOfA= w1*w1*h1 , vOfB = w2*w2*h2 ;
bool out = false;
int nowV = 0 , k = 0;
for(int i = 1; i <= step ; i++){
//cout << k;
int b;
cin >> b;
nowV += b;
if(out == false && nowV <= vOfA){
k = b/(w1*w1);
if(k > max_high){
max_high = k;
}
k = 0;
}
else if (out == true && nowV <= vOfA + vOfB){
k = b/(w2*w2);
if(k > max_high){
max_high = k;
}
k = 0;
}
else if(out == false && (nowV > vOfA && (nowV <= vOfA+vOfB) ) ){
int g = nowV - vOfA;
k = g / (w2*w2);
k += (b-g) / (w1*w1);
if(k > max_high){
max_high = k;
}
k = 0 ;
out = true;
}
else if (out == true){
int g = nowV - (vOfA + vOfB);
k = (b - g) / (w2*w2);
if(k > max_high){
max_high = k;
}
k = 0 ;
}else if (b<nowV){
int g = (nowV-b)/(w1*w1);
k =h2+h1-g;
if(k > max_high){
max_high = k;
}
k = 0 ;
}
else{
max_high = h1 + h2;
}
}
cout << max_high;
}