fun main(args: Array<String>){
    val a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    val c = readLine()!!.toInt()
    val d = readLine()!!.toInt()
    val e = readLine()!!.toInt()
    
    val sum = maxTime(a) + maxTime(b) + maxTime(c) + maxTime(d) + maxTime(e)
    sum -= intArrayOf(remTime(a),remTime(b),remTime(c),remTime(d),remTime(e)).max()
    println(sum)
}

fun maxTime(x:Int):Int{
    return ( x + 9 ) / 10 * 10
}

fun remTime(x:Int):Int{
    return maxTime(x) - x
}