import java.lang.Math
fun main(args: Array<String>) {
    val a = IntArray(5) {readLine()!!.toInt()}
    var ans = 999999
    for (i in 0 until 5) {
        var now = 0
        for (j in 0 until 5) {
            if (j == i) {
                now += j
            }
            now += ((j + 9) / 10) * 10
        }
        ans = Math.max(ans, now)
    }
    println(ans)
}