process.stdin.resume();
process.stdin.setEncoding('utf8'); 
var lines = [];
var reader = require('readline').createInterface({
	input: process.stdin,
	output: process.stdout
});
 
reader.on('line', (line) => {
	lines.push(line);
});

reader.on('close', () => {
	const meals = lines.map(Number);
	
	const shortenTime = meals.reduce((cur, next) => Math.max(cur, (10-next%10)%10 ), 0);
	
	console.log(meals.reduce((cur, next) => cur + Math.ceil(next/10)*10, 0) - shortenTime);
});