open Array;;let a=make 100 0;;let($)x y=if x>=0&&x<=9&&y>=0&&y<=9then a.(10*y+x)<-a.(10*y+x)+1;;let rec g x y=function|1->(x$y;x$(y-1);(x-1)$y;(x+1)$y;x$(y+1))|2->(g x y 1;(x-1)$(y-1);(x+1)$(y-1);(x-1)$(y+1);(x+1)$(y+1))|3->(g x y 2;x$(y-2);(x-2)$y;(x+2)$y;x$(y+2))|_->();;let rec f()=f(Scanf.scanf"%d,%d,%d
"(fun x y s->g x y s));;try f()with _->(Printf.printf"%d
%d
"(fold_left(fun z e->if e=0then z+1else z)0a)(fold_left(fun z e->max z e)0a))