"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const A = parseInt(arg[0].split(" ")[0]);
    const B = parseInt(arg[1].split(" ")[0]);
    const C = parseInt(arg[2].split(" ")[0]);
    const D = parseInt(arg[3].split(" ")[0]);
    const E = parseInt(arg[4].split(" ")[0]);
    
    const list = [A, B, C, D, E];
    let last = Infinity;
    let lastIdx = -1;
    
    for(let i=0; i<5; i++) {
        let temp = list[i] % 10;
        
        if(temp !== 0) {
            if(last > temp) {
                lastIdx = i;
                last = temp;
            }
        }
    }
    
    let answer = 0;
    
    for(let i=0; i<5; i++) {
        let temp = list[i] % 10;
        
        if(i === lastIdx) {
            answer += list[i];
        } else {
            if(temp !== 0) {
                answer += list[i] + (10 - temp);
            } else {
                answer += list[i];
            }
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));