main(r,T,a,b,c,d,e,A,B,C){for(;scanf("%d%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&A,&B,&C)>7;printf("%d\n",r)){
	r=a*A+b*B+c*C;
	if(C>=d){
		if(r>a*A+b*B+e*C)r=a*A+b*B+e*C;
	}else{
		if(r>a*A+b*B+e*d)r=a*A+b*B+e*d;
		//if(B+C>=d){
			if(r>a*A+b*(B+C-d)+e*d)r=a*A+b*(B+C-d)+e*d;
		//}else if(A+B+C>=d){
			if(r>a*(A+B+C-d)+e*d)r=a*(A+B+C-d)+e*d;
		//}else{
			if(r>e*d)r=e*d;
		//}
	}
}exit(0);}