import Data.List
import qualified Data.ByteString.Char8 as B
import Control.Monad

main :: IO ()
main = breads >>= main'
    where
        main' [q, h, s, d] = readLn >>= print . solve q h s d
        solve q h s d n
            | even n = v * m
            | otherwise = v * m + u
            where
                m = n `div` 2
                u = minimum [q * 4, h * 2, s]
                v = minimum [q * 8, h * 4, s * 2, d]

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)
