import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val t = (1..5).map {
        val x = sc.nextInt()
        val mod = if (x % 10 == 0) 10 else x % 10
        Pair(mod, x)
    }.sortedBy { it.first }

    val sum = t.map { it.second + (10 - it.first) }.sum() - (10 - t[0].first)
    println(sum)
}