fun main(args: Array<String>) {
    val dishes_time_ms = IntArray(5){ readLine()!!.toInt() }
    
    var ans_time = 0
    var min_diff_time = 0
    
    for(dishe_time in dishes_time_ms){
        ans_time += dishe_time
        val time: Int = when(dishe_time){
            in 0..99 -> dishe_time % 10
            in 100..123 -> (dishe_time % 100) % 10
            else -> 0
        }
        if(time != 0){
            val diff_time = 10 - time
            ans_time += diff_time
            
            if(min_diff_time < diff_time){
                min_diff_time = diff_time
            }
        }
    }
    
    println(ans_time - min_diff_time)
}
