import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val a = sc.nextInt()
  val b = sc.nextInt()
  val c = sc.nextInt()
  val d = sc.nextInt()
  val e = sc.nextInt()


  var sum = 0
  sum += calc(a)
  sum += calc(b)
  sum += calc(c)
  sum += calc(d)
  sum += calc(e)

  val list = mutableListOf<Int>()
  list.add(left(a))
  list.add(left(b))
  list.add(left(c))
  list.add(left(d))
  list.add(left(e))
  val min = list.min()!!


  println(sum + min - 10)
}

private fun calc(a: Int): Int {
  if (a % 10 == 0) return a

  val ret = a / 10 + 1
  return ret * 10
}

private fun left(a: Int): Int {
  if (a % 10 == 0) return 10
  return a % 10
}