times = []
5.times { times << gets.to_i}
ceils = times.map do |time|
  if time % 10 != 0
    time += 10- time % 10
  else
    time
  end
end
puts ceils.inspect
lastdif = [times, ceils].transpose.map{|a| a.inject(:-) }.min
ans = ceils.inject(:+) + lastdif
puts ans