import * as fs from 'fs';

const main = (input: string) => {
  const lines = input.split("\n").map(str => parseInt(str));
  let answer = 0;
  let maxTime;
  let w: number[] = [];


  lines.forEach((time) => {
    if (time % 10 !== 0) {
      w.push(time % 10)
    }

    answer += (Math.round(time / 10) * 10)
  });

  maxTime = w.reduce((a, b) => Math.min(a, b))

  console.log(answer - maxTime);
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());