fun main(args: Array<String>) {
    val A = IntArray(5)
    repeat(5) { i ->
        A[i] = readLine()!!.toInt()
    }
    val B = A.map { ((it + 9) / 10) * 10 }
    val max = A.zip(B).maxBy { it.second - it.first }!!
    println(B.sum() - max.second + max.first)
}