#!/usr/bin/ruby

@paper = Array.new(10)
@paper.map!{|c| c = Array.new(10, 0) }

@patt = [[[-1,0],[0,-1],[0,0],[0,1],[1,0]], \
        [[-1,-1],[-1,1],[1,1],[1,-1]], \
        [[0,-2],[-2,0],[2,0],[0,2]]]

def drop(x, y, num)
  @patt[num].each do |xa, ya|
    next unless [x+xa, y+ya].any?{|x| (0...10) === x}
    @paper[x+xa][y+ya] += 1
  end
end

until gets.nil?
  x, y, size = $_.split(?,).map(&:to_i)
  drop(x, y, 0)         
  drop(x, y, 1) if size > 1
  drop(x, y, 2) if size > 2
end

puts @paper.map{|x| x.join }

puts @paper.flatten.count(0), @paper.flatten.max