public int theCount(int N, int muddyCount){
        int[][][] dp = new int[N][muddyCount+1][3];
        dp[0][0][1] = 1;
        for(int i=0; i<N-1; i++){
            int bound = Math.min(i, muddyCount);
            for(int j=0; j<=bound; j++){
                for(int r=0; r<3; r++){
                    dp[i+1][j][(r+1)%3] = (dp[i+1][j][(r+1)%3]+dp[i][j][r])%MOD;
                    if(i<N-2 && r!=0 && j<muddyCount) dp[i+2][j+1][1] = (dp[i+2][j+1][1]+dp[i][j][r])%MOD;
                }
            }
        }
        int[][] C = new int[N-1][muddyCount+1];
        for(int i=0; i<=N-2; i++){
            int bound = Math.min(i, muddyCount);
            for(int j=0; j<=bound; j++){
                if(j==0) C[i][j] = 1; else C[i][j] = (C[i-1][j]+C[i-1][j-1])%MOD;
            }
        }
        int odd = (dp[N-1][muddyCount][1]+dp[N-1][muddyCount][2])%MOD;
        return (C[N-2][muddyCount]-odd+MOD)%MOD;
    }