const main = (input) => {
  var p = input.trim().split("\n");
  var ans = 0;
  var min = 10;
  for(var i=0;i<5;i++){
    if(p[i]%10 >0){
      ans += Number(p[i])+(10-p[i]%10);
      min = Math.min(min, p[i]%10);
    }else{
      ans += Math.floor(p[i]);
    }
  }
  console.log(min==10?ans:ans+min-10);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
