require 'pp'
x = 5.times.each.map {|i| readline.to_i }
x.sort_by! {|d|
  r = d%10
  (r == 0) ? 10 : r
}
sum = 0
x[1..-1].each do |x|
  if x % 10 == 0
    sum += x
  else
    sum += ((x+10)/10)*10
  end
end
puts sum + x[0]
