function main(input) {
  const arr = input.split("\n").map(v => parseInt(v));
  const par = arr.map(v => v % 10).filter(v => v !== 0);
  console.log(arr.map(v => Math.ceil(v / 10) * 10).reduce((a,b) => a+b) - (Math.max(...(par.map(v => 10 - v)))));
}
main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
