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.maxBy {
        10 - it % 10
    }

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

    print(computed.sum())

}