def ceil_time(t)
  (t * 0.1).ceil * 10
end

cooking_minutes = STDIN.read.split(/\s+/).map(&:to_i)
ceiled_cooking_minutes = cooking_minutes.map { |t| ceil_time(t) }

max_item = -1
max_dt = -1
cooking_minutes.each.with_index { |t, i|
  dt = ceiled_cooking_minutes[i] - t
  if dt > max_dt
    max_dt = dt
    max_item = i
  end
}
ceiled_cooking_minutes.delete_at(max_item)
puts ceiled_cooking_minutes.reduce(0) { |a, x| a + x } + cooking_minutes[max_item]
