t = {}
for i = 1, 5 do table.insert(t, io.read("*n")) end
table.sort(t, function(a, b)
        ad = a % 10
        bd = b % 10
        if(ad == 0) then ad = 10 end
        if(bd == 0) then bd = 10 end
        return ad > bd
    end
);
sum = 0
for i = 1, 4 do
    if(t[i] % 10 == 0) then sum = sum + t[i] else
        sum = sum + 10 * (1 + math.floor(t[i] / 10))
    end
end
sum = sum + t[5]
print(sum)