<?php
$num = 0;
// 標準入力を一行ずつ配列に代入します
while ($line = fgets(STDIN)) {
   if((int)trim($line) == 0)
   {
     continue;
   }
   $num += ceil((int)trim($line)/10) * 10;
   if(substr(trim($line), -1) != '0'){
     $rest[] = substr(trim($line), -1);
   }
}

$d = min($rest);

echo $num-10+$d;