var lines = [];

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var v = [];
    for (var i = 0; i < 5; i++) {
        v[i] = Number(lines[i]);
    }
    var result = 0; var hoge = 0;
    var max = Infinity;
    for (var i = 0; i < 5; i++) {
        for (var j = 1; j < 10; j++) {
            if (v[i] % 10 === 0) { break; }
            if ((v[i] - j) % 10 === 0) { if (j < max) { max = j; hoge = i; } }
        }
    }
    for (var i = 0; i < 5; i++) {
        for (var j = 1; j < 10; j++) {
            if (v[i] % 10 === 0) { result += v[i];break; }
            if (i === hoge) { result += v[i]; break;}
            if ((v[i] - j) % 10 === 0) { result += v[i] + 10 - j; break;}
        }
    }
    console.log(result);
});