var stdin = require("fs").readFileSync("/dev/stdin", "utf8");
stdin = stdin.trim().split("\n");
var stdout = [];
function print(x){stdout.push(x)};


var menu = stdin.map(n=>parseInt(n));
var dmin = 9
var ans = 0
for (i=0; i < 5; i++){
    dmin = Math.min((menu[i]-1) % 10, dmin)
    ans += parseInt((menu[i]+9)/10) * 10
}

print(ans - 10 + dmin + 1);


stdout = stdout.join("\n");
console.log(stdout);