fun main(args: Array<String>) {
    val a = (1..5).map { readLine()!!.toInt() }
    if(a.all{it%10==0}){
        println(a.sum())
    }else{
        val ans = a.map { (it+9)/10*10 }.sum() -10 +a.map { it%10 }.filter { it!=0 }.min()!!
        println(ans)
    }
}