<?php
    $min = 9;
    for ($i=0; $i < 5; $i++) { 
        fscanf(STDIN, "%d", $N[$i]);
        $nowmin = $N[$i]%10;
        if ($min > $nowmin && $nowmin != 0) {
            $min = $nowmin;
        }
        if ($nowmin == 0) {
            $result += $N[$i];
        }else{
            $result += $N[$i] + 10 - $nowmin;
        }
    }
    $result = $result - 10 + $min;


    echo $result;
