program abc
    integer(8),dimension(5) :: limits
    integer(8) :: est_time, num_person

    read *, num_person
    do i=1,5
        read *, limits(i)
    end do

    est_time = 5 + num_person/MINVAL(limits)
    if (MOD(MINVAL(limits), num_person) == 0) then
        est_time = est_time-1
    end if

    print '(I0)', est_time
end program abc
