listMake a b c = listc 1 a $ listc 0 b $ replicate c (-1)

listc g 0 xs = xs
listc g x xs = listc g (x-1) (g:xs)



main = do
 [a,b,c,k] <- map read <$>words<$>getLine :: IO [Int]
 print $sum$take k $listMake a b c