import java.util.*
fun main(args: Array<String>) {

    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()
    var ok = true
    val A = a-a%10+ if (a%10 == 0) 0 else 10
    val B = b-b%10+ if (b%10 == 0) 0 else 10
    val C = c-c%10+ if (c%10 == 0) 0 else 10
    val D = d-d%10+ if (d%10 == 0) 0 else 10
    val E = e-e%10+ if (e%10 == 0) 0 else 10

   // println("$A $B $C $D $E")
    var ar = intArrayOf(a,b,c,d,e)
    val min = ar.minBy { (it-1)%10 }
    var t = min!!%10
    if (t == 0) t = 10
    //val (N,K) = readLine()!!.split(" ").map{it.toInt()}
    //for (i in  0 until N) {
    //}

        println(A+B+C+D+E+t-10)
}
