#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main() {
	long long int m[3];
	long long int d, e;
	long long int nn[3];
	while(cin >> m[0] >> m[1] >> m[2] >> d >> e) {
		if (m[0] == 0 && m[1] == 0 && m[2] == 0 && d == 0 && e == 0) {
			break;
		}
		cin >> nn[0] >> nn[1] >> nn[2]; 
		long long int count = m[0]*nn[0]+m[1]*nn[1]+m[2]*nn[2];
		vector<int> v;
		for (int i = 0; i < nn[2]; i++) {
			v.push_back(m[2]);
		}
		for (int i = 0; i < nn[1]; i++) {
			v.push_back(m[1]);
		}
		for (int i = 0; i < nn[0]; i++) {
			v.push_back(m[0]);
		}
		if (d <= nn[2]) {
			count = m[0]*nn[0]+m[1]*nn[1]+e*nn[2];
		} else if (d <= nn[1]+nn[2]){
			count = min(count, min(m[0]*nn[0]+m[1]*(nn[1]-(d-nn[2]))+e*d, m[0]*nn[0]+m[1]*nn[1]+d*e));
		} else if (d <= nn[0]+nn[1]+nn[2]){
			count = min(count, min(m[0]*(nn[0]-(d-nn[2]-nn[1]))+e*d, m[0]*nn[0]+m[1]*nn[1]+d*e));
		} else {
			count = min(count, d*e);
		}
		cout << count << endl;
	}
	return 0;
}