d = []
5.times do
  d << gets.to_i
end

dsum = []
5.times do |i|
  sum = d[i]
  dc = d.dup
  dc.slice!(i)
  dc.each do |data|
    n = data / 10 * 10
    n += 10 if data % 10 != 0
    sum += n
  end
  dsum << sum
end

puts dsum.min