<?php

fscanf(STDIN, '%d', $A);
fscanf(STDIN, '%d', $B);
fscanf(STDIN, '%d', $C);
fscanf(STDIN, '%d', $D);
fscanf(STDIN, '%d', $E);


$amariLast = 9;
$last = null;
foreach ([$A, $B, $C, $D, $E] as $val) {
    $amari = $val % 10;
    if ($amari < $amariLast && $amari !== 0) {
        $last = $val;
        $amariLast = $amari;
    }
}

$ans = 0;
foreach ([$A, $B, $C, $D, $E] as $val) {
    if ($val === $last) {
        $ans += $last;
    } else {
        $ans += (ceil($val / 10) * 10);
    }
}


echo intval($ans) . PHP_EOL;