
ab :: Int -> Int -> Int -> Int -> Int -> Int
ab a b c x y =
    if a + b >= c * 2 then
      2 * (max x y)
    else
      0
    
main :: IO ()
main = do
    [a,b,c,x,y] <- map read . words <$> getLine
    let
      d = c * 2
      ad = a < d
      bd = b < d
      cx = ab a b c x y
      ax1 = max 0 (x - (div cx 2))
      bx1 = max 0 (y - (div cx 2))
    print (a*ax1 + b*bx1 + c*cx)