import Data.List
main = interact $ unlines . map show . dropping_ink . map (map read . splitOn ',') . lines
splitOn c xs
 | null xs = []
 | head xs == c = splitOn c (tail xs)
 | otherwise = (takeWhile (/= c)) xs : splitOn c (dropWhile (/= c) xs)
dropping_ink inks = [whites,depth]
 where
  whites = 100 - length (nub canvas)
  depth = maximum $ map length $ group $ sort $ canvas
  canvas = filter (\(x,y) -> elem x [0..9] && elem y [0..9]) (concatMap sink inks)
  sink [x,y,s] = case s of
   1 -> [(x,y),(x+1,y),(x-1,y),(x,y+1),(x,y-1)]
   2 -> [(x,y),(x+1,y),(x-1,y),(x,y+1),(x,y-1),(x+1,y+1),(x+1,y-1),(x-1,y+1),(x+1,y+1)]
   3 -> [(x,y),(x+1,y),(x-1,y),(x,y+1),(x,y-1),(x+1,y+1),(x+1,y-1),(x-1,y+1),(x+1,y+1),(x+2,y),(x-2,y),(x,y+2),(x,y-2)]