times = readlines.map(&:to_i)

times.sort! do |a,b|
  t = b % 10
  t == 0 ? -1 : a % 10 <=> b % 10
end

last = times.shift
total = 0
times.each do |t|
  total += t.quo(10).ceil * 10
end
total += last

puts total
