PAPER_SIZE = 10

Small = [[0, 0], [0, 1], [1, 0], [0, -1], [-1, 0]]
Medium = Small + [[1, 1], [1, -1], [-1, -1], [-1, 1]]
Large = Medium + [[0, 2], [2, 0], [0, -2], [-2, 0]]
Radiuses = [nil, Small, Medium, Large]

paper = PAPER_SIZE.times.map{[0] * PAPER_SIZE}

$<.each_line do |line|
	x, y, size = line.split(',').map(&:to_i)
	Radiuses[size].each do |dx, dy|
		i = x + dx
		j = y + dy
		next if i < 0 or PAPER_SIZE <= i or j < 0 or PAPER_SIZE <= j

		paper[j][i] += 1
	end
end

paper.flatten!
puts paper.count(0)
puts paper.max