arr = Array.new(5) { gets.to_i }
all = arr.inject(:+)
x = 0
min = 99
for i in 0..4 do
    if arr[i]%10 != 0
        if arr[i]%10 < min
            x += (10 - min)
            min = arr[i]%10
        elsif
            x += 10 - arr[i]%10
        end
    end
end

if min == 99
    puts all
elsif
    puts all + x - (10 - 99)
end