import java.util.Scanner

val sc = Scanner(System.`in`)
val a = sc.nextInt()
val b = sc.nextInt()
val c = sc.nextInt()
val d = sc.nextInt()
val e = sc.nextInt()

fun main(args: Array<String>) {
    var list = mutableListOf(a, b, c, d, e)
    var tmp = 0
    var maxIdx = 0
    for (i in 0 until  list.size) {
        if (diff(list[i]) > tmp) {
            tmp = diff(list[i])
            maxIdx = i
        }
    }
    var total = 0
    for (i in 0 until list.size) {
        if (i == maxIdx) {
            total += list[maxIdx]
        } else {
            total += (list[i] + diff(list[i]))
        }
    }
    println(total)
}

fun diff(v: Int): Int {
    return if (v % 10 == 0) {
        0
    } else {
        10 - (v % 10)
    }
}