-- B
local a,b,c,d,e = io.read("n", "n", "n", "n", "n")
local tbl = {a,b,c,d,e}
table.sort(tbl, function(x,y)
    local rx = x % 10
    if rx == 0 then
        rx = 10
    end
    local ry = y % 10
    if ry == 0 then
        ry = 10
    end
    return rx > ry
end)

local tm = 0
for i=1, #tbl-1 do
    local r = 10 - tbl[i] % 10
    if r == 10 then
        r = 0
    end
    tm = tm + tbl[i] + r
end
tm = tm + tbl[#tbl]

print(tm)
