map = 10.times.map{ Array.new(10){0} }
readlines.each do |l|
  x, y, size = l.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|
    xt, yt = x+dx, y+dy
    map[xt][yt] += 1 if (0..9).include?(xt) && (0..9).include?(yt)
  end
end
puts map.map{|i| i.count{|j| j==0} }.inject(:+)
puts map.map{|i| i.max}.max