arr = 10.times.map{ [0] * 10 }
while gets do
  x, y, size = $_.split(/,/).map(&:to_i)

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

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