Same as above case for ' q ' and ' r '
if ( $ last == 1 ) return countWays ( $ p , $ q - 1 , $ r , 0 ) + countWays ( $ p , $ q - 1 , $ r , 2 ) ; if ( $ last == 2 ) return countWays ( $ p , $ q , $ r - 1 , 0 ) + countWays ( $ p , $ q , $ r - 1 , 1 ) ; }