max = 0
count = 0
ans = 0
5.times do |i|
    a = 0
    x =  gets.to_i
    amari = x % 10
    a = 10 - amari if amari != 0
    ans = ans + x + a
    if max <= a
        max = a
    end
end
puts ans - max
