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 = Infinity;
    var NextTime = Array(5);

    for (var i = 0; i < 5; i++) {
        if (v[i] % 10 === 0) { NextTime[i] = v[i]; }
        else { NextTime[i] = v[i] - v[i] % 10 + 10 }
    }

    for (var i = 0; i < 5; i++) {
        var Time = 0;
        for (var j = 0; j < 5; j++) {
            i === j ? Time += v[j] : Time += NextTime[j];
        }
        result = Math.min(result, Time);
    }
    console.log(result);
});