($h,$w)=glob<>; <>; for(reverse<>){ / /; if(y/R//){ $x=($x-1)%$w if $y==$'; }else{ $y=($y-1)%$h if $x==$'; } } print$x+$y&1?black:white