import Control.Monad
import Data.List

ans k xs rate
  | diff <= 0 = k * rate
  | otherwise = head xs * rate + ans diff (tail xs) (rate-1)
  where diff = k - head xs 

main :: IO ()
main = do
  [a, b, c, k] <- map read . words <$> getLine
  putStrLn $ show $ ans k [(a::Int),(b::Int),(c::Int)] 1
