import strutils, sequtils, math
var AA, BB, AB, a, b, ttl: int64
(AA, BB, AB, a, b) = stdin.readline.split.map(parseBiggestInt)
proc buyAB = ttl += 2 * AB; a -= 1; b -= 1
if 2 * AB < [AA, BB].min:
  while a > 0 or b > 0:
    buyAB()
else:
  if 2 * AB < [AA, BB].sum:
    while a > 0 and b > 0:
      buyAB()
  for a in 0 ..< a: ttl += AA
  for b in 0 ..< b: ttl += BB
echo ttl
