function Main(input){
  var data = input.split("\n");
  console.log(Math.ceil(data[0]/10)*10
  +Math.ceil(data[1]/10)*10
  +Math.ceil(data[2]/10)*10
  +Math.ceil(data[3]/10)*10
  +Math.ceil(data[4]/10)*10
  +Math.min(
  	(data[0]-1)%10+1,
    (data[1]-1)%10+1,
    (data[2]-1)%10+1,
    (data[3]-1)%10+1,
    (data[4]-1)%10+1
  )
  -10);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));