x = []
y = []
5.times do
  s = gets.chomp
  if s[-1] == "0"
    x << s.to_i
  else
    y << s
  end
end
t = 0
x.each do |i|
  t += i
end
y.sort{|a,b| a[-1] <=> b[-1]}.map(&:to_i).reverse.each_with_index do |i, idx|
  if y.size-1 == idx
    t += i
  else
    t += (i.to_f/10).ceil*10
  end
end
p t