<?php
fscanf(STDIN, "%d", $A);
fscanf(STDIN, "%d", $B);
fscanf(STDIN, "%d", $C);
fscanf(STDIN, "%d", $D);
fscanf(STDIN, "%d", $E);
$input_arr = array($A, $B, $C, $D, $E);
$minimum = 9;
$ans = 0;
foreach($input_arr as $value){
    if ($minimum % 10 > ($value % 10)){
        if (($value % 10) > 0){
            $minimum = $value;
        }
    }
}
#echo $minimum;
foreach($input_arr as $value){
    $ans += ceil($value / 10) * 10;
}
$ans -= ceil($minimum / 10) * 10;
$ans += $minimum;
echo $ans;