//1909
#include<stdio.h>
int MONEY(int num,int a_price,int a_num,int b_price,int b_num,int c_price,int c_num );
int main()
{
int num,a_price,a_num,b_price,b_num,c_price,c_num;
scanf("%d",&num);
scanf("%d%d",&a_num,&a_price);
scanf("%d%d",&b_num,&b_price);
scanf("%d%d",&c_num,&c_price);
printf("%d",MONEY( num, a_price,a_num,b_price,b_num,c_price,c_num));
return 0;
}
int MONEY(int num,int a_price,int a_num,int b_price,int b_num,int c_price,int c_num )
{
int n1,price1,n2,price2,n3,price3;
if(num%a_num==0)n1=num/a_num;
else n1=num/a_num+1;
price1=n1*a_price;
if(num%b_num==0)n2=num/b_num;
else n2=num/b_num+1;
price2=n2*b_price;
if(num%c_num==0)n3=num/c_num;
else n3=num/c_num+1;
price3=n3*c_price;
return (price1<price2)?((price1<price3)?price1:price3):((price2<price3)?price2:price3);
}