'use strict';

function Main(input) {
    input = input.split("\n");
    const order = input.map(x => {
        for (let i = 10; i <= 130; i += 10) {
            if ((i - 10) <= x && x <= i) {
                return i;
            }

        }
        return 120;
    });
//    console.log(order);
    const ones = input.map(x => {
        return x - Math.floor(x / 10) * 10;
    });
//    console.log(ones);
    const target = ones.reduce((a, b) =>
            (b <= a && b >= 1) ? b : a
        , 9);
//    console.log(target)
    
    console.log('%d',
        (order.reduce((a, b) => a + b)) - (10 - target)
        );


}
/*
Main(`123
123
123
123
123`);
*/
Main(require("fs").readFileSync("/dev/stdin", "utf8"));