ans' n a b =
     let n' = fromIntegral n :: Float
         a' = fromIntegral a :: Float
     in
       b * ceiling ( n' / a' )

ans [n,a,b,c,d] =
    let o1 = ans' n a b
        o2 = ans' n c d
    in
      minimum [ o1, o2 ]

main = do
     l <- getLine
     let i = map read $ words l :: [Int]
         o = ans i
     print o
