[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let div x y = (x + y - 1L) / y

[<EntryPoint>]
let main _ =
    let n = read int64
    let xs = List.map (fun _ -> read int64) [1..5]
    let f (g, t) x =
        let g' = min g x
        (g', t + div g g')
    List.fold f (n, 0L) xs
    |> snd
    |> printfn "%i"
    0