If the above cases are not followed then we find ways to fill the n - 1 rows and m - 1 columns which is 2 ^ ( ( m - 1 ) * ( n - 1 ) ) .
return ( modPower ( modPower ( 2 , $ n - 1 ) , $ m - 1 ) % $ mod ) ; }