import java.util.*

fun main(args:Array<String>) {
    val scanner= Scanner(System.`in`)
    var ae=IntArray(5)
    var t=IntArray(5)
    var m=10
    for (i in 0 until 5){
        ae[i]=scanner.nextInt()
        t[i]=ae[i]%10
        if (t[i]!=0){
            if (m>t[i]) m=t[i]
        }
    }

    println(ae.sum()+(10*(5-t.count { it==0 }))-t.sum()-10+m)
}
