import java.util.*

fun main(args: Array<String>) {
  val scanner = Scanner(System.`in`)
  val list = ArrayList<Int>()

  var min = 10
  var sum = 0
  for (i in 0..4) {
    list.add(scanner.nextInt())
    min = if (list[i] % 10 != 0) { if (list[i] % 10 < min) list[i] % 10 else min } else min
    sum += if (list[i] % 10 != 0) (list[i] / 10 + 1) * 10 else list[i]
  }
  scanner.close()
  println(sum - 10 + min)
}
