object Main {
  def main(args: Array[String]): Unit = {
    var cuisine_list = Vector.empty[Int]
    cuisine_list = cuisine_list :+ io.StdIn.readInt()
    cuisine_list = cuisine_list :+ io.StdIn.readInt()
    cuisine_list = cuisine_list :+ io.StdIn.readInt()
    cuisine_list = cuisine_list :+ io.StdIn.readInt()
    cuisine_list = cuisine_list :+ io.StdIn.readInt()
    var sum_time      = 0
    var min_last_time = 9

    (0 until cuisine_list.length).foreach { i =>
      val last_time = cuisine_list(i)%10
      if(last_time < min_last_time && last_time != 0) min_last_time = last_time
      sum_time += (cuisine_list(i)/10.0 + 0.9).toInt*10
    }
    println(sum_time - 10 + min_last_time)

  }
}