fun main(args: Array<String>) {
    val a = (1..5).map { readLine()!!.toInt() }.toTypedArray()
    println(solve(a))
}

fun solve(a: Array<Int>) : Int {
    val adj : Int = a.filter{it % 10 != 0}.minBy {it % 10}?.rem(10) ?: 10
    val sum = a.sumBy { (it + 9) / 10 * 10 }
    return sum - (10 - adj)
}
