c = []
sum = 0
5.times do
    t = gets.chomp
    sum += t.to_i
    c << t[-1].to_i if t[-1] != '0'
end
if c.empty?
    puts sum
else
    c.delete_at(c.index(c.min))
    puts sum + c.length*10 - c.inject(:+)
end
