fun main(arr:Array<String>) {
    val dishes = (1..5).map { readLine()!!.toInt() }.sortedByDescending { if(it%10==0) 10 else it%10 }
    var current = 0
    for(i in dishes) {
        if(current % 10 != 0) {
            current += (10 - current%10)
        }
        current += i
    }
    println(current)
}
