function Main(input) {
    input = input.split("\n").map(Number);
    var max = 0;
    input.forEach(function(val){
        if(max<(10-((val-0.1)%10))-0.1) max = 10-((val-0.1)%10)-0.1;
    });
    var sum = 0;
        input.forEach(function(val){
            sum += Math.ceil(val/10)*10;
    });
    console.log(sum-max);
}Main(require("fs").readFileSync("/dev/stdin","utf8").trim());
