fun time (x: Int): Int {
  return ((x + 9) / 10) * 10
}

fun remain (x: Int): Int {
  if (x % 10 == 0) {
    return 0
  } else {
    return (10 - x % 10)
  }
}

fun main (args: Array<String>) {
  val a = readLine()!!.toInt()
  val b = readLine()!!.toInt()
  val c = readLine()!!.toInt()
  val d = readLine()!!.toInt()
  val e = readLine()!!.toInt()
  var sum = time(a) + time(b) + time(c) + time(d) + time(e)
  val lis = intArrayOf(remain(a), remain(b), remain(c), remain(d), remain(e))
  println(sum - lis.max()!!.toInt())
}
