import Control.Applicative

main = do
  [a, b, c, d, e] <- fmap read . lines <$> getContents
  print $ calc a b c d e

calc :: Int -> Int -> Int -> Int -> Int -> Int
calc a b c d e
  | a <= 0 && b <= 0 = (b - a) * c
  | a >= 0 && b >= 0 = (b - a) * e
  | otherwise = (-a) * c + d + b * e
