<?php
$result = 0;

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

foreach ($arg as $minutes) {
	$trim[] = mb_substr(strval($minutes), -1);
}

$min_key = min(array_keys($trim));

foreach ($arg as $key => $value) {
	if ($key != $minkey) {
		$value = ceil(($value/10))*10;
	}
	$result = $value + $result;
}

echo $result;