A, B, C, D, E = io.read("*n", "*n", "*n", "*n", "*n")
S = {A, B, C, D, E}
T = {0, 0, 0, 0, 0}
U = 0
for i = 1, 5 do
    U = U + S[i]
    if S[i]%10 ~= 0 then
        T[i] = 10-S[i]%10
    end
end
table.sort(T)
for i = 1, 4 do
    U = U + T[i]
end
print(U)