inks = {
 1 => [[0, 1, 0],
       [1, 1, 1], 
       [0, 1, 0]],
 2 => [[1, 1, 1], 
       [1, 1, 1], 
       [1, 1, 1]],
 3 => [[0, 0, 1, 0, 0], 
       [0, 1, 1, 1, 0], 
       [1, 1, 1, 1, 1], 
       [0, 1, 1, 1, 0], 
       [0, 0, 1, 0, 0]] }
cell = Array.new(10).map { cell = Array.new(10, 0) }

while s = gets
  break if s.nil? || s.chomp == ""
  x, y, i = s.split(',').map(&:to_i)

  ink = inks[i]
  iy   = ink.size
  cy  = (iy / 2).floor
  ix   = ink[cy].size
  cx  = (ix / 2).floor
  sx  = x - cx
  sy  = y - cy
  
  ix.times { |x| 
    next if sx + x < 0 || sx + x > 9 
    iy.times { |y| 
      next if sy + y < 0 || sy + y > 9 
      cell[sy + y][sx + x] += ink[y][x]
    }   
  }
end

e, m = 0, 0
cell.each { |c| c.each { |v| 
  e += 1 if v == 0
  max = c.max
  m = max if max > m 
} }

puts e
puts m