import scala.io.StdIn._

object Main extends App {
  val n = 5
  val a = (1 to 5).map(_ => readLine.toInt).toArray
  var min_v_index = 0
  var result = 0
  for (i <- (1 to 4)) {
    if (a(i) % 10 < a(min_v_index) % 10 && a(i) % 10 != 0) {
      min_v_index = i 
    }
  }
  a.zipWithIndex.foreach{ case (x, i) => {
    if (i != min_v_index) {
      if (a(i) % 10 == 0) {
        result += a(i)
      } else if (a(i) / 10 == 0) {
        result += 10
      } else {
        result += (a(i) / 10) * 10 + 10
      }
    }
  }}
  result += a(min_v_index)
  println(result)
}