class Canbus
  def initialize
    @arr = Array.new(14){Array.new(13,0)}
  end
  
  def small(x, y)
    for i in 1..3
      @arr[x + 2][y + i] += 1
    end
    @arr[x + 1][y + 2] += 1
    @arr[x + 3][y + 2] += 1
  end
  
  def midium(x, y)
    for i in 1..3
      for j in 1..3
        @arr[x + i][y + j] += 1
      end
    end
  end
  
  def big(x, y)
    midium(x, y)
    @arr[x][y + 2] += 1
    @arr[x + 2][y] += 1
    @arr[x + 2][y + 4] += 1
    @arr[x + 4][y + 2] += 1
  end
  
  def count
    return @arr[2..11].inject(0){|sum,i|sum + i[2..11].select{|j|j == 0}.size}, @arr[2..12].inject(0){|max,i|max > i[2..12].inject(0){|max,j|max > j ? max: j} ? max: i[2..12].inject(0){|max,j|max > j ? max: j}}
  end
end
Comand = [:small, :midium, :big]
can = Canbus.new
while arg = gets
  arg = arg.split(",").map(&:to_i)
  can.send(Comand[arg[2] - 1],*arg[0..1])
end
puts can.count