fun main(args: Array<String>) {
    var fraction = Int.MAX_VALUE
    var ans = 0
    for (i in 0 until 5) {
        val dish = readInputLine().toInt()
        if (dish % 10 == 0) {
            ans += dish
        } else {
            ans += dish / 10 * 10 + 10
            if (dish % 10 < fraction) {
                fraction = dish % 10
            }
        }
    }
    
    if (fraction != Int.MAX_VALUE) {
        ans -= 10
        ans += fraction
    }
    
    println(ans)
}
 
fun readInputLine(): String {
    return readLine()!!
}