fun main(args: Array<String>) {
    (0..5).map {
        readLine()!!.toInt()
    }.sortedByDescending { 
        it % 10
    }.fold(0) { m, n ->
        m + (10 - m % 10) + n
    }.let {
        print(it)
    }
}