function Main(input){
const abcde = input.split('\n');
var total_time = 0;
const len = abcde.length;
var i = 0;
var j = 0;
var last_cal_num = 10;
var last_cal_num_index = 0;
for(i = 0; i < len; i++){
  j = abcde[i] % 10
  if(0 < j && j < last_cal_num){
    last_cal_num = j;
    last_cal_num_index = i;
  }
}

for(i = 0; i < len; i++){
  if(i !== last_cal_num_index){
    var j = parseInt(abcde[i].trim());
    var k = j % 10;
    j = k ? j + (10-k) : j;
    total_time += j;
  }
}

total_time += parseInt(abcde[last_cal_num_index].trim());
console.log(total_time);

}
Main(require("fs").readFileSync("/dev/stdin","utf-8"));
