fun main(args: Array<String>) {
    val C = Array(5) { readLine()!!.toInt() }
    val C1 = C.map { Pair(it, it % 10) }.toMutableList()
    val last = C1.filterNot { it.second == 0 }.sortedBy { it.second }.first()

    C1.removeAt(C1.indexOf(last))
    (C1.map {
        if (it.second == 0) {
            it.first
        } else {
            it.first + (10 - it.second)
        }
    }.sum() + last.first).let(::println)
}