function Main(input) {
  var list = input.split("\n").map(s => parseInt(s, 10));
  var ans = 0;
  var last = 10;
  
  for (i = 0; i < 5; i++) {
    ans += Math.ceil(list[i]/10);
    if (last > (list[i]-1)%10) last = (list[i]-1)%10;
  }
  
  console.log(ans * 10 - 9 + last);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));