fun main(args : Array<String>) {
    val times = Array(5,{readLine()!!.toInt()})
    
    var sum = 0;
    var min = 10;
    for (time in times){
       val e = time % 10;
       if(e != 0)
       {
         sum += time + (10 - e);
         if (min > e){min = e;}
       }else{
         sum += time;
       }
    }
    if(min != 10){
      sum = sum - 10 + min;
    }
    
    println(sum)
}