class Square
  attr_reader :squares

  def initialize
    @squares = build_two_dimensions
  end

  def build_two_dimensions
    Array.new(10) { [] }.map { Array.new(10) { 0 } }
  end

  def update(x, y, size)
    range = case size
            when 1
              small_range
            when 2
              middle_range
            when 3
              large_range
            else
              []
            end

    range.each do |a, b|
      increment(x + a, y + b)
    end
  end

  def zero_count
    squares.flatten.select(&:zero?).count
  end

  def max
    squares.flatten.max
  end

  private

  def large_range
    middle_range.concat [[-2, 0], [0, -2], [0, 2], [2, 0]]
  end

  def middle_range
    small_range.concat [[-1, -1], [-1, 1], [1, -1], [1, 1]]
  end

  def small_range
    [[-1, 0], [0, -1], [0, 0], [0, 1], [1, 0]]
  end

  def increment(x, y)
    squares[x][y] += 1 if x.between?(0, 9) && y.between?(0, 9)
  end
end

square = Square.new
STDIN.read.split("\n").each do |line|
  x, y, size = line.split(',').map(&:to_i)
  square.update(x, y, size)
end
puts [square.zero_count, square.max]