<?php
$result = 0;

/*while (!feof(STDIN) ) {
	$arg[] = trim(fgets(STDIN));
}*/

for (i=0; i<5; i++) {
	$arg[] = trim(fgets(STDIN));
}

foreach ($arg as $minutes) {
	$trim = intval(mb_substr(strval($minutes), -1));
	if ($trim == 0) {
		$trims[] = 10;
	} else {
		$trims[] = $trim;
	}
}

$min = min($trims);
$min_key = array_keys($trims, $min);

foreach ($arg as $key => $value) {
	if ($key != $min_key[0]) {
		$value = ceil((intval($value)/10))*10;
	}
	$result = $value + $result;
}

echo $result;
