L = gets.split.map(&:to_i) R, B, Y = gets.split.map(&:to_i) ans = 2 * L.permutation.map {|l| R * (l[0] + l[1]) + B * (l[1] + l[2]) + Y * (l[2] + l[0])}.min puts ans