f a b c x y
    | a > b = f' b a c y x
    | otherwise = f' a b c x y
  where
    f' a b c x y
        | a + b <= c * 2              = a * x + b * y
        | a + b >  c * 2 && a <  c * 2 = c * y * 2 + a * (max 0 (x - y))
        | a + b >  c * 2 && a >= c * 2 = c * y * 2 + c * (max 0 (x - y)) * 2

main = do
    [a, b, c, x, y] <- map read . words <$> getLine
    print $ f a b c x y
    -- print $ f 1500 2000 1600 3 2
    -- print $ f 1500 2000 1900 3 2
    -- print $ f 1500 2000 500 90000 100000
