import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto xs = 5.iota.map!(_ => readln.chomp.to!int).array;
    auto cs = xs.map!(x => x % 10).filter!(m => m > 0).array;
    auto m = 10 - (cs.empty ? 0 : cs.reduce!min);
    writeln(xs.map!(x => cast(int)(ceil(x * 0.1) * 10)).sum - m);
}

