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 += a[j]
            } else {
                now += ((a[j] + 9) / 10) * 10
            }
        }
        ans = Math.min(ans, now)
    }
    println(ans)
}