arr = 10.times.map{ Array.new(10){0} }
while gets do
  x, y, size = $_.split(",").map(&:to_i)

  drops = [[0, 0], [0,1], [1,0], [0,-1], [-1,0]]
  drops += [[1, 1], [1, -1], [-1, 1], [-1, -1]] if size>=2
  drops += [[2, 0], [0, 2], [-2, 0], [0, -2]] if size>=3

  drops.each do |dx, dy|
    nx, ny = dx + x, dy + y
    arr[nx][ny] += 1 if (0..9).include?(nx) && (0..9).include?(ny)
  end
end
puts arr.map{ |i| i.count { |v| v == 0 } }.inject(:+)
puts arr.map{ |i| i.max }.max