meshi = []
(0..4).each do |i|
  meshi[i] = gets.chomp.to_i
end

meshi.sort! do |a,b|
  ret = 0
  if a % 10 == 0
    ret = -1
  elsif a % 10 != 0 && b % 10 == 0
    ret = 1
  elsif (a % 10) > (b % 10)
    ret = -1
  elsif (a % 10) < (b % 10)
    ret = 1
  end
  ret == 0 ? a <=> b : ret
end

sumtime = 0

(0..4).each do |i|
  sumtime += meshi[i]
  sumtime += 10 - (meshi[i] % 10) if meshi[i] % 10 != 0 && i != 4
end

puts sumtime