#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	while(1){
		int a,b,c,d,e,na,nb,nc,ans=0;
		cin>>a>>b>>c>>d>>e;
		if(a==0) break;
		cin>>na>>nb>>nc;
		int n=na+nb+nc,sum=a*na+b*nb+c*nc;
		if(n<d){
			ans=min(d*e,sum);
		}else{
			if(nc>=d) ans=nc*e+nb*b+na*a;
			else if(nb+nc>=d){
				ans=min(sum,d*e+(nc+nb-d)*b+na*a);
			}else{
				ans=min(sum,d*e+(n-d)*a);
			}
		}
		o(ans);
	}
}