#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int a, b, c, d, e, na, nb, nc, ans;
  while(cin >> a >> b >> c >> d >> e >> na >> nb >> nc && a){
    ans = a * na + b * nb + c * nc;
    if(nc < d){
      if(nb + nc >= d) ans = min(ans, a * na + b * (nb - (d - nc)) + e * d);
      else if(na + nb + nc >= d) ans = min(ans, a * (na - (d - nb - nc)) + e * d);
      else ans = min(ans, e * d);
    }else ans = min(ans, a * na + b * nb + e * nc);
    cout << ans << endl;
  }
}