fun main(args: Array<String>) {
    val a = (0 until 5).map {
        val x = readLine()!!.toInt()
        val y = if (x % 10 == 0) 10 else x % 10
        Pair(x , 10 - y)
    }
    val b = a.sortedBy { it.second }
    print(b.sumBy { it.first + it.second } - b.last().second)
}