const dishes = require('fs')
	.readFileSync('/dev/stdin', 'utf8').split(/\s+/).map(i=>parseInt(i));

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

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