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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int[] a;
    foreach (_; 0..5) a ~= readint;

    auto b = a.map!(e => e/10*10 + (e%10?10:0));
    int c = a.filter!(e => e % 10 > 0).map!(e => 10 - e%10).reduce!max;
    writeln(b.sum - c);
}
