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

  val menus = Array.tabulate(5){_ ⇒ readInt()}.sortBy{it ⇒ (10 - (it % 10)) % 10}

  var time = 0
  for (menu ← menus) {
    time = (time + 9) / 10 * 10 + menu
  }
  println(time)
}