function main(input) {
    var foods = input.split(/\n/).map(s => ~~s);
    var lastServeIndex = 0;
    foods.reduce((minSurplus, curTime, index) => {
        const curSurplus = curTime % 10;
        if (curSurplus !== 0 && minSurplus > curSurplus) {
            lastServeIndex = index;
            return curSurplus;
        } else {
            return minSurplus;
        }
    }, 10);

    const res = foods.reduce((pre, cur, index) => {
        if (index === lastServeIndex) {
            return pre + cur;
        } else {
            return pre + Math.ceil(cur / 10) * 10;
        }
    }, 0)

    console.log(res);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));