function Main(input){
  
  var str = input;
  var tmp = str.split("\n");
  var a = tmp[0];
  var b = tmp[1];
  var c = tmp[2];
  var d = tmp[3];
  var e = tmp[4];
     //console.log(a);
　var a1 = parseInt(a.slice(-1),10);
  var b1 = parseInt(b.slice(-1),10);
  var c1 = parseInt(c.slice(-1),10);
  var d1 = parseInt(d.slice(-1),10);
  var e1 = parseInt(e.slice(-1),10);
  
　var array = [a1,b1,c1,d1,e1];
  
  for(i=0;i<5;i++){
    if(array[i]==0){
      array[i]=10;
    }//if end
    
  }//for owari
      //console.log(array);
   //console.log(Math.min.apply(null,array));
  var min_index = array.indexOf(Math.min.apply(null,array));
  //var min_index = array.indexOf('5');  
    //console.log(min_index);

  var kekka = 0;
  
  for(i=0;i<5;i++){
    if(i==min_index){
      tmp[i]= parseInt(tmp[i],10);
    }else{
      tmp[i]=Math.ceil(tmp[i]/10)*10;
    }
    
  }//for end
    //console.log(tmp);
function sum(a) {
  return a.reduce(function(x, y) { return x + y; });
}
  
  var kekka = sum(tmp);
     console.log(kekka); 
  
}//function end
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));