"use strict";
function main(input) {
    const args = input.split('\n');

    let ans_time = 0;
    let first = 9;
    let food_first;
    let flag = false

    for(var i = 0; i < args.length - 1; i++) {
        const food = parseInt(args[i]);
        ans_time += Math.ceil(food / 10) * 10;
        food_first = food % 10;
        if (food_first !== 0 && food_first < first) {
            first = food_first;
            flag = true;
        }
    }
    if (!flag) { first = 10; }
    console.log(ans_time - 10 + first);

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