class DroppingInk
  def initialize
    init_stage
    init_ink
  end

  def drop(x, y, size)
    if size == 1 || size == 2
      3.times do |i|
        3.times do |j|
          next if 0 > (j + x - 1) || (j + x - 1) > 9 || 0 > (i + y - 1 ) || (i + y - 1) > 9
          @stage[j + x - 1][i + y - 1] += size == 1 ? @small[j][i] : @medium[j][i]
        end
      end
    elsif size == 3
      5.times do |i|
        5.times do|j|
        next if 0 > (j + x - 2) || (j + x - 2) > 9 || 0 > (i + y - 2) || (i + y - 2) > 9
        @stage[j + x - 2][i + y - 2] += @large[j][i]
        end
      end
    end
  end

  def stage_info
    max = -1
    empty = 0
    10.times do |i|
      10.times do |j|
        if @stage[i][j] == 0
          empty += 1
        elsif @stage[i][j] > max
          max = @stage[i][j]
        end
      end
    end
    [max, empty]
  end

  def init_stage
    @stage = Array.new(10){Array.new(10, 0)}
  end

  def init_ink
    @large = Array.new(5){Array.new(5, 1)}
    @large[0][0] = @large[1][0] = @large[3][0] = @large[4][0] = 0
    @large[0][1] = @large[4][1] = 0
    @large[0][3] = @large[4][3] = 0
    @large[0][4] = @large[1][4] = @large[3][4] = @large[4][4] = 0

    @medium = Array.new(3){Array.new(3, 1)}

    @small = Array.new(3){Array.new(3, 1)}
    @small[0][0] = @small[2][0] = 0
    @small[0][2] = @small[2][2] = 0
  end
end

dropping_ink = DroppingInk.new

while line = gets do
  x, y, size = line.chomp.split(",").map(&:to_i)
  dropping_ink.drop(x, y, size)
end
max, empty = dropping_ink.stage_info
puts empty
puts max