function Main(input) {
    var min_amari = 100;
    var sum = 0;
    for(var i = 0; i< 5; i++) {
        var time = parseInt(input[i]);
        min_amari = Math.min(min_amari, ((time + 9) % 10) + 1);
        sum += Math.floor((time + 9) / 10) * 10;
    }
    
    sum = sum - 10 + min_amari;

    console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));