a,b,c,x,y=gets.split.map(&:to_i)

ret = 0

a,b = a<b ? [a,b] : [b,a]
x,y = a<b ? [x,y] : [y,x]

if c*2 <= a
  ret += c*2*x
  y = [0,y-x].max
  x = 0
end
if c*2 <= b
  ret += c*2*y
  x = [0,x-y].max
  y = 0
end

d = [x,y].max - (x-y).abs
ret += a+b < c*2 ? (a+b)*d : (c*2)*d
ret += a*(x-d)
ret += b*(y-d)

p ret
