import Control.Applicative

type NumAtA = Int
type NumAtB = Int
type NumAtC = Int
type Numg = Int
type Cost = Int

buyA :: NumAtA -> Cost
buyA x = 1520 * div x 5 + 380 * mod x 5

buyB :: NumAtB -> Cost
buyB x = 1870 * div x 4 + 550 * mod x 4

buyC :: NumAtC -> Cost
buyC x = 2244 * div x 3 + 850 * mod x 3

minMaybe :: Maybe Int -> Maybe Int -> Maybe Int
minMaybe Nothing x = x
minMaybe x Nothing = x
minMaybe (Just x) (Just y) = Just $ min x y

solveC :: NumAtC -> Numg -> Maybe Cost
solveC c 0 = Just $ buyC c
solveC c g
    | g < 0 = Nothing
    | otherwise = solveC (succ c) (g - 500)

solveBC :: NumAtB -> NumAtC -> Numg -> Maybe Cost
solveBC b c g
    | g < 0 = Nothing
    | otherwise = minMaybe (solveBC (succ b) c (g - 300)) $ (+) <$> Just (buyB b) <*> solveC c g

solveABC :: NumAtA -> NumAtB -> NumAtC -> Numg -> Maybe Cost
solveABC a b c g
    | g < 0 = Nothing
    | otherwise = minMaybe (solveABC (succ a) b c (g - 200)) $ (+) <$> Just (buyA a) <*> solveBC b c g

solve :: Numg -> Cost
solve = maybe undefined id . solveABC 0 0 0

main :: IO ()
main = getContents
    >>= return . takeWhile (/= 0) . map read . lines
    >>= return . map solve
    >>= mapM_ print