#include<bits/stdc++.h>
using namespace std;
int main(){
double a,b[2],c[2],d[2],B,C,D,e[2];
cin>>a;
cin>>b[0];
cin>>b[1];
cin>>c[0];
cin>>c[1];
cin>>d[0];
cin>>d[1];
B=ceil(a/b[0])*b[1];
C=ceil(a/c[0])*c[1];
D=ceil(a/d[0])*d[1];
e[0]=B;
e[1]=C;
e[2]=D;
sort(e,e+3);
cout<<e[0];
return 0;
}