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 = cs.empty ? 0 : (10 - cs.reduce!min);
    writeln(xs.map!(x => cast(int)(ceil(x * 0.1) * 10)).sum - m);
}

