'use strict'
function Main(input) {
  const cookT = input.split("\n").map(Number);
  cookT.pop();
  // console.log({ cookT });

  let hitoketa = 10;

  for (let i = 0; i < 5; i++) {
    let num = cookT[i] % 10;
    if (num !== 0 && hitoketa > num) {
      hitoketa = num;
    }
  }

  let result = 0;

  for (let i = 0; i < 5; i++) {
    result += Math.ceil(cookT[i] / 10) * 10;
    // console.log(result);
  }
  result = result - 10 + hitoketa;
  console.log(result);



}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));