const dishes = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/).map(i=>parseInt(i,10)).slice(0,5);

const minRest = Math.min(...(dishes.map(i => i % 10).filter(i => i !== 0)));

console.log(dishes.map(i => Math.ceil(i / 10) * 10).reduce((a,c)=>a+c) - 10 + minRest);