function main(input) {
  var args = input.split("\n");
  var a = parseInt(args[0], 10);
  var b = parseInt(args[1], 10);
  var c = parseInt(args[2], 10);
  var d = parseInt(args[3], 10);
  var e = parseInt(args[4], 10);
  
  var a_1 = a % 10; 
  var b_1 = b % 10; 
  var c_1 = c % 10; 
  var d_1 = d % 10; 
  var e_1 = e % 10;
  
  var min = Math.min(a_1, b_1, c_1, d_1, e_1);
  
  var a_min = parseInt(a/10) * 10 +10;
  var b_min = parseInt(b/10) * 10 +10;
  var c_min = parseInt(c/10) * 10 +10;
  var d_min = parseInt(d/10) * 10 +10;
  var e_min = parseInt(e/10) * 10 +10;
  
  if(min == a_1){
    console.log(a+b_min+c_min+d_min+e_min);
  }else if(min == b_1){
    console.log(a_min+b+c_min+d_min+e_min);
  }else if(min == c_1){
    console.log(a_min+b_min+c+d_min+e_min);
  }else if(min == d_1){
    console.log(a_min+b_min+c_min+d+e_min);
  }else if(min == e_1){
    console.log(a_min+b_min+c_min+d_min+e);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));