fun main(args: Array<String>) {
    val aTime = readLine()!!.toInt()
    val bTime = readLine()!!.toInt()
    val cTime = readLine()!!.toInt()
    val dTime = readLine()!!.toInt()
    val eTime = readLine()!!.toInt()

    val timeList = mutableListOf(aTime, bTime, cTime, dTime, eTime)
    val maxTime = timeList.filter{
        it % 10 != 0
    }.maxBy {
        10 - it % 10
    }


    var decided = false
    val computed = timeList.map {
        if (it == maxTime && !decided) {
            decided = true
            it
        } else {
            if (it%10 == 0) it else it + 10 - it%10
        }
    }

    print(computed.sum())

}