### subroutines

def setcost(d, n, e, cost)
  k = (n >= d) ? n : d
  (k * e < cost) ? k * e : cost
end

def min_cost(a, b, c, d, e, na, nb, nc)
  minc = a * na + b * nb + setcost(d, nc, e, c * nc)
  for n in (1..nb)
    c = a * na + b * (nb - n) + setcost(d, nc + n, e, c * nc + b * n)
    minc = c if minc > c
  end
  for n in (1..na)
    c = a * (na - n) + setcost(d, nc + nb + n, e, c * nc + b * nb + a * n)
    minc = c if minc > c
  end
  minc
end

### main

loop do
  a, b, c, d, e = gets.split.map(&:to_i)
  break if a == 0

  na, nb, nc = gets.split.map(&:to_i)

  puts min_cost(a, b, c, d, e, na, nb, nc)
end