
fun main(args : Array<String>) {
    val list = mutableListOf<Int>()
    (0..4).forEach {
        list.add(readLine()!!.toInt())
    }



    list.sortBy {
        val lastDigit = it.mod(10)

        if (lastDigit == 0) {
            -10
        } else {
           lastDigit * -1
        }
    }

    var sum = 0
    list.forEachIndexed { index, value ->
        if (index == list.size - 1) {
            sum += value
        } else {
            val mod = value.mod(10)

            if (mod == 0) {
                sum += value
            } else {
                sum += value + (10 - mod)
            }
        }
    }

    println(sum)
}
