import scala.io.StdIn._
object Main extends App {

  val n = readLong()
  val times = Array.tabulate(5){_ ⇒ readLong()}
  println(
    solve(times.toList, n)
  )

  def solve(times: List[Long], size: Long): Long = {
    times match {
      case h::t ⇒ math.max((size + h - 1) / h + t.length, solve(t, size) + 1)
      case Nil ⇒ 0
    }
  }
}