def mk2d(n)
  arr = Array.new
  n.times do
    a = Array.new(10, 0)
    arr << a
  end
  arr
end
def smallInk(x, y)
  a = [[x, y],
       [x + 1, y],
       [x - 1, y],
       [x, y + 1],
       [x, y - 1]]
  a 
end
def midInk(x, y)
  arr = smallInk(x, y)
  arr << [x + 1, y + 1]
  arr << [x - 1, y + 1]
  arr << [x - 1, y - 1]
  arr << [x + 1, y - 1]
  arr
end
def largeInk(x, y)
  arr = midInk(x, y)
  arr << [x + 2, y]
  arr << [x - 2, y]
  arr << [x, y + 2]
  arr << [x, y - 2]
  arr
end
def drop(arr)
  arr.each do |i|
    x = i[0]
    y = i[1]
    if x >= 0 and x <= 9 and y >= 0 and y <=9
      $paper[i[0]][i[1]] += 1
    end
  end
end
  
#main
$paper = mk2d(10)
arr = Array.new
while line = gets
  arr << line 
end
arr.each do |i|
  a = i.split(",")
  a.map!{|j| j.to_i}
  case a[2]
    when 1
    drop(smallInk(a[0], a[1]))
    when 2
    drop(midInk(a[0], a[1]))
    when 3
    drop(largeInk(a[0], a[1]))
  end
end
empty = 0
max = 0
0.upto($paper.length - 1) do |i|
  0.upto($paper.length - 1) do |j|
    if $paper[i][j] == 0
      empty += 1
    end
    if max < $paper[i][j]
      max = $paper[i][j]
    end
  end
end
p empty
p max