import kotlin.math.ceil

fun main(args: Array<String>) {
    var foodsTimes = listOf(
        readLine()!!.toInt(),
        readLine()!!.toInt(),
        readLine()!!.toInt(),
        readLine()!!.toInt(),
        readLine()!!.toInt()
    ).sortedByDescending {(it-1) % 10 }

    var sum = 0
    for(fTime in foodsTimes){
        sum += ceil(fTime.toDouble()/10).toInt()*10
    }
    println(sum - ceil(foodsTimes.get(4).toDouble()/10).toInt()*10 + foodsTimes.get(4))
}