object Main extends App {
  val a = io.StdIn.readLine.toInt
  val b = io.StdIn.readLine.toInt
  val c = io.StdIn.readLine.toInt
  val d = io.StdIn.readLine.toInt
  val e = io.StdIn.readLine.toInt
  val s = Seq(a, b, c, d, e)

  var min = Integer.MAX_VALUE
  for (p <- s.permutations) {
    var accum = 0
    for (i <- 0 until p.size) {
      if (p(i) % 10 == 0)
        accum += p(i)
      else if (i < p.size - 1)
        accum += ((p(i) / 10) + 1) * 10
      else
        accum += p(i)
    }
    if (min > accum)
      min = accum
  }
  println(min)
}